{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import numpy_extended as npe\n",
    "import pickle\n",
    "from scipy import io as sio\n",
    "import os"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "PHCv2.4.86 released 2022-05-30 works!\n"
     ]
    }
   ],
   "source": [
    "from minimal_winding_model import * "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Using matplotlib backend: QtAgg\n"
     ]
    }
   ],
   "source": [
    "%matplotlib"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "char_poly = minimal_winding_char_poly()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Calculation for x major"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "data = sio.loadmat(\"data/minimal_winding_aGBZ.mat\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "aGBZ_params = data['params']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "with open(\"data/minimal_winding_aGBZ.pkl\", \"rb\") as fp:\n",
    "    aGBZ_points = pickle.load(fp)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "8\n"
     ]
    }
   ],
   "source": [
    "print(len(aGBZ_points[0]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "curr_ptr = 10\n",
    "curr_param = aGBZ_params[curr_ptr,:]\n",
    "curr_point = aGBZ_points[curr_ptr]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[ 0.77908057+0.62692381j -0.6506183 +0.75940492j]\n",
      "[[ 2.66972350e+000-2.23887943e-010j  1.14220424e+000-4.02497244e-001j\n",
      "  -1.02518420e-001-1.32877883e+000j  1.07578154e+000-7.86674831e-001j]\n",
      " [-1.93072557e+000-8.19099455e-001j -1.01424213e+000+1.31381630e-001j\n",
      "  -1.00511979e+000-2.43807931e-001j -3.21837706e-001-9.82918409e-001j]\n",
      " [ 1.01192634e+000-3.92671064e-011j  7.44580508e-001-2.62380048e-001j\n",
      "   5.39577398e-002+6.99366046e-001j -5.66207907e-001+4.14044575e-001j]\n",
      " [-6.26580639e+063-3.36224271e+064j  4.88694865e-112+2.51640015e-112j\n",
      "  -1.15503232e-111+1.45308968e-111j  6.25563743e-112-3.81510697e-112j]\n",
      " [-1.93072557e+000+8.19099454e-001j -8.72542615e-001+5.33495662e-001j\n",
      "   9.55826574e-001-3.95099567e-001j  8.39098273e-001+6.04667013e-001j]\n",
      " [-2.37312999e+000-2.25823698e-010j -2.03122861e+000+7.15777346e-001j\n",
      "  -3.15119484e+000+2.43122114e-001j  1.86559690e+000+2.55121255e+000j]\n",
      " [ 1.40836554e+000+7.12654520e-001j  1.51736964e+000+8.32833324e-001j\n",
      "  -2.10913800e+000+8.58695247e-001j  1.84039549e+000+1.34118047e+000j]\n",
      " [ 1.40836554e+000-7.12654521e-001j  6.60030174e-001-1.60011942e+000j\n",
      "  -2.21589403e+000-5.25008827e-001j  7.20146387e-001+2.16037261e+000j]]\n"
     ]
    }
   ],
   "source": [
    "print(curr_param)\n",
    "print(curr_point)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "+(-1+0*i)*(y**2)+(-1+0*i)*x*y+(-1+0*i)*(x**3)+(-1+0*i)*(x**3)*y+(1+0*i)*E*(x**2)*y;\n",
      "aGBZ_2D_solver_IndexVec[0, 2, 1]\n"
     ]
    }
   ],
   "source": [
    "print(char_poly.num.to_str(csolver.CStrVec(['E', 'x', 'y'])))\n",
    "print(char_poly.denom_orders)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "winding_solver = csolver.GBZConditionChecker2D(curr_point[0, :3], curr_param[1], char_poly, 1, 0.1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[-6.26580639e+063-3.36224271e+064j  4.88694865e-112+2.51640015e-112j\n",
      " -1.15503232e-111+1.45308968e-111j  6.25563743e-112-3.81510697e-112j]\n"
     ]
    }
   ],
   "source": [
    "print(curr_point[3,:])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n"
     ]
    }
   ],
   "source": [
    "for j in [0]:\n",
    "    print(j)\n",
    "    winding_solver = csolver.GBZConditionChecker2D(curr_point[j, :3], curr_param[1], char_poly, 1, 0.1)\n",
    "    vals, params = winding_solver.eval_param_path(curr_point[j,1] * np.exp(1j * np.linspace(0, 2 * np.pi, 200)), curr_point[j,[0,2]],\n",
    "                                                N_points_loop=200, N_points_detour=50, theta_detour=1e-2*np.pi)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "vals2, params2 = winding_solver.eval_param_path(curr_point[j,1] * np.exp(1j * np.linspace(0, 2 * np.pi, 200)), params[-1],\n",
    "                                            N_points_loop=200, N_points_detour=50, theta_detour=1e-2*np.pi)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "vals1, params1 = winding_solver.eval_param_path(curr_point[0,1] * np.exp(1j * np.linspace(0, 2 * np.pi, 200)), curr_point[0,[0, 2]],\n",
    "                                            N_points_loop=200, N_points_detour=50, theta_detour=1e-2*np.pi)\n",
    "vals2, params2 = winding_solver.eval_param_path(curr_point[0,1] * np.exp(1j * np.linspace(0, 2 * np.pi, 200)), params1[-1],\n",
    "                                            N_points_loop=200, N_points_detour=50, theta_detour=1e-2*np.pi)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "N_points_loop = 200\n",
    "N_points_detour = 50\n",
    "theta_detour = 1e-3 * np.pi\n",
    "zero_val_th = 1e-3\n",
    "eval_fun = lambda beta_path, start_param: winding_solver.eval_param_path(\n",
    "    beta_path, start_param, \n",
    "    theta_detour = theta_detour, N_points_loop=N_points_loop, N_points_detour = N_points_detour, \n",
    "    zero_eps=zero_val_th\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "beta0 = curr_point[0,1]\n",
    "circular_loop = beta0 * np.exp(1j * np.linspace(0, 2 * np.pi, N_points_loop))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "vals1, params1 = eval_fun(circular_loop, curr_point[0, [0,2]])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "vals2, params2 = eval_fun(circular_loop, params1[-1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n",
      "0 finishes\n",
      "1\n"
     ]
    }
   ],
   "source": [
    "result = csolver.winding_phase_auto_detour_path_check(\n",
    "    curr_point[0,1], theta_detour, zero_val_th, N_points_loop, N_points_detour, eval_fun, \n",
    "    curr_point[0,[0,2]], 0.1\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "([(1.1399425195654302-0.40885890938225256j), (1.1404081050575916-0.409007593271071j), (1.1408822753612267-0.40912608070692685j), (1.1413630742098686-0.4092138828506924j), (1.1418485179899127-0.4092706374603878j), (1.1423366039243368-0.40929611038566877j), (1.1428253183354828-0.40929019653385207j), (1.14331264495281-0.40925292030349225j), (1.143796573231345-0.40918443548372135j), (1.1442751066465138-0.40908502461976715j), (1.1447462709311247-0.4089550978472669j), (1.1452081222205293-0.4087951912001863j), (1.1456587550723505-0.4086059643993243j), (1.1460963103276953-0.4083881981305282j), (1.1465189827814142-0.4081427908238474j), (1.1469250286297696-0.4078707549469149j), (1.1473127726647798-0.40757321282784736j), (1.1476806151855614-0.40725139202489924j), (1.1480270385981548-0.4069066202619714j), (1.1483506136766037-0.4065403199508715j), (1.1486500054594593-0.40615400232292304j), (1.1489239787573795-0.40574926119413585j), (1.149171403249103-0.40532776638965945j), (1.1493912581447727-0.4048912568546489j), (1.1495826363973707-0.4044415334799643j), (1.1497447484448868-0.40398045167230395j), (1.1498769254677845-0.4035099136994229j), (1.149978622148326-0.403031860842019j), (1.1500494189203663-0.4025482653846646j), (1.150089023700344-0.40206112247882686j), (1.1500972730923185-0.40157244191154673j), (1.150074133062085-0.40108423981373686j), (1.1500196990775902-0.40059853034230647j), (1.149934195715063-0.4001173173704305j), (1.1498179757324885-0.39964258622024595j), (1.149671518614248-0.39917629547208355j), (1.149495428592929-0.39872036888402684j), (1.1492904321564648-0.39827668745513667j), (1.1490573750508906-0.3978470816650842j), (1.1487972187910827-0.39743332392221054j), (1.1485110366938713-0.3970371212511685j), (1.1482000094498985-0.3966601082503159j), (1.147865420252488-0.39630384034791477j), (1.1475086495036222-0.3959697873849601j), (1.1471311691188704-0.3956593275511121j), (1.1467345364547632-0.3953737416987519j), (1.146320387883664-0.39511420805861686j), (1.1458904320426513-0.39488179737881884j), (1.145446442784258-0.3946774685072994j), (1.1449902518581556-0.3945020644359467j), (1.1543412065301706-0.3662389037239172j), (1.1653275013787483-0.32961548844796384j), (1.1751521724308143-0.29266350528476254j), (1.1838054262406001-0.25541978877474913j), (1.1912786370565205-0.2179214642645043j), (1.197564355419509-0.18020591089940025j), (1.202656315588802-0.14231072436325626j), (1.2065494417877642-0.10427367940214272j), (1.2092398532635347-0.06613269216969336j), (1.2107248681554441-0.0279257824314586j), (1.2110030061683523+0.010308964334024118j), (1.2100739900482393+0.04853343489966294j), (1.2079387458585777+0.08670952628190554j), (1.2045994020572124+0.12479918372262161j), (1.2000592873746672+0.16276443862291373j), (1.1943229274959948+0.20056744639104207j), (1.1873960405494741+0.23817052416673679j), (1.1792855314066575+0.2755361883842922j), (1.1699994847994426+0.31262719213700096j), (1.1595471572610376+0.34940656230567996j), (1.1479389678988463+0.38583763641428026j), (1.2110207171111118-0.007961056595376418j), (1.2115092661805484-0.007947036750233054j), (1.2119959074071844-0.007901681862478917j), (1.2124786330737383-0.007825179051057058j), (1.2129554516172052-0.0077178439407197905j), (1.2134243958453756-0.007580119359867603j), (1.2138835310528036-0.007412573513588791j), (1.2143309630027488-0.007215897639437247j), (1.2147648457421576-0.0069909031556198474j), (1.2151833892174408-0.006738518313359092j), (1.2155848666596307-0.006459784367242175j), (1.2159676217084456-0.006155851279356362j), (1.2163300752458739-0.005827972974933959j), (1.2166707319110803-0.005477502169080448j), (1.21698818626976-0.005105884785929005j), (1.2172811286124863-0.004714653993246053j), (1.2175483503581273-0.0043054238770990575j), (1.2177887490400456-0.0038798827826827596j), (1.2180013328545023-0.003439786348777331j), (1.218185224752503-0.0029869502645759392j), (1.2183396660582073-0.002523242778764591j), (1.2184640195989684-0.002050576991759272j), (1.2185577723340915-0.0015709029629j), (1.2186205374714674-0.0010861996651648415j), (1.2186520560633454-0.0005984668205960321j), (1.2186521980746645-0.00010971665012246562j), (1.2186209629195337+0.0003780344281839997j), (1.2185584794636504+0.0008627741181682286j), (1.2184650054926418+0.0013425025476458633j), (1.2183409266485314+0.0018152405192002619j), (1.2181867548387078+0.002279037675682348j), (1.2180031261239692+0.002731980546725247j), (1.2177907980943508+0.003172200443076521j), (1.2175506467435646+0.003597881166178668j), (1.2172836628549455+0.004007266501190727j), (1.2169909479138132+0.0043986674625373715j), (1.2166737095631168+0.004770469262092716j), (1.2163332566211076+0.005121137971250569j), (1.2159709936815972+0.00544922684939558j), (1.2155884153190781+0.005753382312666236j), (1.2151870999226144+0.0060323495183845265j), (1.2147687031839414+0.0062849775421128795j), (1.214334951266641+0.006510224125979528j), (1.2138876336845752+0.006707159978682346j), (1.213428595918954+0.0068749726094307914j), (1.212959731804506+0.007012969680008386j), (1.2124829757161544+0.0071205818611262935j), (1.212000294588441+0.007197365181283595j), (1.2115136798006174+0.00724300285844371j), (1.2110251389608884+0.007257306606970045j), (1.1351864880084754+0.42188409917583986j), (1.1213024295392167+0.4575100186923523j), (1.1063006324224978+0.4926798822724633j), (1.0901960507759383+0.5273586318312944j), (1.0730047379967604+0.5615116988371036j), (1.0547438307594135+0.5951050387699508j), (1.0354315319333631+0.6281051650580144j), (1.0150870924380764+0.6604791824577354j), (0.9937307920532863+0.6921948198445108j), (0.9713839192036653+0.7232204623812529j), (0.9480687497380624+0.7535251830327461j), (0.923808524724451+0.7830787733943884j), (0.8986274272827275+0.8118517738045861j), (0.8725505584784514+0.8398155027107852j), (0.8456039123015577+0.8669420852598667j), (0.8178143497549821+0.8932044810844058j), (0.7892095720790283+0.918576511257099j), (0.7598180931381704+0.9430328843864889j), (0.7296692109978128+0.9665492218279708j), (0.6987929787193403+0.9891020819849577j), (0.6672201744025732+1.0106689836759741j), (0.6349822705054893+1.0312284285443842j), (0.6021114024717917+1.0507599224884239j), (0.5686403366976007+1.0692439960901654j), (0.5346024378691971+1.0866622240230577j), (0.5000316357043775+1.1029972434186912j), (0.4649623911305736+1.1182327711744842j), (0.4294296619334503+1.1323536201850326j), (0.39346886791022445+1.1453457144809478j), (0.3571158555624417+1.157196103260088j), (0.32040686236340254+1.1678929737971995j), (0.2833784806358627+1.1774256632190996j), (0.24606762107600838+1.1857846691336587j), (0.2085114759600721+1.1929616591019927j), (0.1707474820702639+1.1989494789444182j), (0.13281328337697124+1.203742159871895j), (0.09474669351443099+1.2073349244358456j), (0.056585658087277724+1.2097241912904182j), (0.018368216845537688+1.210907578762451j), (-0.019867534234219664+1.2108839072255764j), (-0.05808348092378002+1.2096532002760971j), (-0.09624152873637631+1.207216684709465j), (-0.13430364090010072+1.2035767892973857j), (-0.1722318762737869+1.1987371423667648j), (-0.2099884271675645+1.1927025681829142j), (-0.2475356570303865+1.1854790821406176j), (-0.2848361379669607+1.1770738847678563j), (-0.3218526880466921+1.1674953545481648j), (-0.35854840836743834+1.1567530395687764j), (-0.3948867198371375+1.1448576480028827j), (-0.4308313996366444+1.1318210374354933j), (-0.4663466173274215+1.117656203043538j), (-0.5013969705681025+1.10237726464199j), (-0.535947520404314+1.0859994526089292j), (-0.5699638260965862+1.0685390927035692j), (-0.6034119794516302+1.0500135897923855j), (-0.636258638622763+1.0304414104995658j), (-0.6684710613457845+1.0098420647990787j), (-0.7000171375771804+0.9882360865667057j), (-0.7308654215021098+0.965645013111428j), (-0.7609851628802787+0.9420913637065687j), (-0.7903463376984481+0.9175986171420908j), (-0.8189196780990218+0.8921911883204301j), (-0.8466767015548857+0.8658944039191878j), (-0.8735897392614094+0.8387344771449481j), (-0.8996319637173107+0.8107384816033846j), (-0.9247774154668957+0.7819343243117j), (-0.9490010289770059+0.7523507178803052j), (-0.9722786576228867+0.7220171518914658j), (-0.9945870977580709+0.6909638635034427j), (-1.015904111844275+0.6592218073094376j), (-1.0362084506182632+0.6268226244813796j), (-1.0554798742735743+0.5937986112293177j), (-1.0736991726359997+0.5601826866078568j), (-1.090848184312705+0.5260083597017269j), (-1.1069098147959002+0.49130969622319937j), (-1.121868053503017+0.45612128455464396j), (-1.1357079897364055+0.4204782012700768j), (-1.148415827546642+0.38441597617007034j), (-1.1599788994846316+0.34797055686487255j), (-1.170385679228797+0.31117827294104905j), (-1.1796257930747662+0.27407579974736107j), (-1.1876900302761066+0.23670012183597905j), (-1.1945703522257978+0.19908849609547952j), (-1.2002599004692895+0.16127841461236456j), (-1.2047530035411582+0.12330756729813708j), (-1.2080451826185474+0.0852138043191768j), (-1.2101331559857558+0.047035098366870864j), (-1.211014842305522+0.008809506805609324j), (-1.2106893626937483-0.029424866263621507j), (-1.20915704159559-0.06762990798623914j), (-1.2064194064620422-0.10576753474578432j), (-1.2024791862273427-0.14379973012649921j), (-1.1973403085887124-0.18168858280891814j), (-1.1910078960911403-0.21939632436069229j), (-1.1834882610211186-0.2568853668849888j), (-1.1747888991144195-0.29411834048892055j), (-1.1649184820841825-0.3310581305346697j), (-1.153886848976762-0.36766791463616444j), (-1.1417049963639507-0.40391119936443654j), (-1.1283850673813607-0.4397518566250613j), (-1.1139403396238787-0.47515415967143154j), (-1.0983852119102722-0.5100828187179538j), (-1.0817351899301337-0.544503016117674j), (-1.0640068707874715-0.5783804410692666j), (-1.0452179264563575-0.6116813238187832j), (-1.0253870861651149-0.6443724693220856j), (-1.0045341177266207-0.6764212903343789j), (-0.9826798078333185-0.707795839893891j), (-0.9598459413365885-0.7384648431672998j), (-0.936055279531139-0.7683977286251618j), (-0.9113315374660471-0.7975646585162844j), (-0.8856993603050876-0.8259365586106391j), (-0.8591842987598945-0.8534851471811883j), (-0.8318127836204556-0.8801829631957299j), (-0.8036120994083291-0.9060033936906441j), (-0.7746103571788352-0.9309207002992811j), (-0.7448364664993482-0.9549100449085199j), (-0.7143201066316112-0.9779475144179416j), (-0.6830916969467973-1.0000101445769296j), (-0.6511823666028269-1.0210759428759293j), (-0.6186239235141382-1.0411239104690662j), (-0.5854488226448725-1.0601340631062466j), (-0.5516901336570578-1.078087451053895j), (-0.5173815079460475-1.0949661779844622j), (-0.4825571450960843-1.1107534188158699j), (-0.4472517587894032-1.125433436483123j), (-0.41150054220288607-1.1389915976253544j), (-0.37533913292672927-1.1514143871726796j), (-0.3388035774401261-1.1626894218183115j), (-0.3019302951793492-1.1728054623625086j), (-0.26475604223406135-1.1817524249160576j), (-0.22731787470805323-1.189521390952109j), (-0.189653111780905-1.196104616196362j), (-0.15179929850742352-1.2014955383467225j), (-0.11379416839191248-1.2056887836147516j), (-0.07567560577459143-1.208680172082373j), (-0.03748160806766848-1.2104667218685066j), (0.0007497521213145064-1.2110466521014716j), (0.03898036494107743-1.2104193846942006j), (0.07717212128533468-1.208585544920486j), (0.11528695078078322-1.2055469607916962j), (0.15328685973647194-1.2013066612345733j), (0.19113396901674712-1.1958688730719316j), (0.2287905517999912-1.1892390168092712j), (0.2662190711855425-1.1814237012314988j), (0.3033822176112973-1.1724307168151464j), (0.34024294604468525-1.1622690279626573j), (0.3767645129099713-1.1509487640664715j), (0.4129105127150451-1.138481209411831j), (0.4486449143412093-1.1248787919283552j), (0.48393209695978545-1.1101550708016117j), (0.518736885539724-1.094324722957027j), (0.553024585910848-1.0774035284296044j), (0.5867610193477486-1.0594083546340465j), (0.6199125566398896-1.0403571395509439j), (0.6524461516139293-1.0202688738458114j), (0.6843293740748669-0.9991635819387772j), (0.7155304421331703-0.9770623020438034j), (0.746018253885647-0.9539870651973417j), (0.7757624184185057-0.9299608732973113j), (0.8047332861016734-0.9050076761743122j), (0.8329019781441942-0.8791523477179111j), (0.8602404153812389-0.8524206610818041j), (0.8867213462640213-0.8248392629925834j), (0.9123183740247408-0.7964356471876932j), (0.9370059829894495-0.7672381270090806j), (0.9607595640126332-0.737275807179838j), (0.9835554390081445-0.7065785547919798j), (1.00537088455203-0.6751769695342809j), (1.026184154533738-0.6431023531898352j), (1.0459745018331106-0.6103866784337635j), (1.0647221990015652-0.5770625569621526j), (1.0824085579268474-0.5431632069840049j), (1.0990159484617426-0.5087224201086118j), (1.1145278159981946-0.4737745276613351j), (1.1289286979692958-0.4383543664614018j), (1.142204239262712-0.40249724409580234j), (1.1543412065301706-0.36623890372391704j), (1.165327501378748-0.3296154884479643j), (1.1751521724308143-0.2926635052847626j), (1.1838054262406001-0.25541978877474875j), (1.1912786370565205-0.21792146426450454j), (1.1975643554195088-0.1802059108994001j), (1.202656315588802-0.1423107243632567j), (1.2065494417877645-0.10427367940214283j), (1.2092398532635347-0.06613269216969297j), (1.210724868155444-0.027925782431458768j), (1.2110030061683523+0.010308964334024395j), (1.2100739900482396+0.0485334348996625j), (1.2079387458585777+0.08670952628190554j), (1.2045994020572126+0.124799183722621j), (1.2000592873746672+0.16276443862291362j), (1.1943229274959948+0.20056744639104235j), (1.1873960405494743+0.2381705241667364j), (1.1792855314066575+0.2755361883842922j), (1.1699994847994428+0.31262719213700035j), (1.1595471572610376+0.34940656230567985j), (1.1479389678988459+0.3858376364142804j), (1.1351864880084754+0.4218840991758396j), (1.1213024295392167+0.45751001869235247j), (1.1063006324224978+0.4926798822724628j), (1.0901960507759383+0.5273586318312941j), (1.0730047379967602+0.5615116988371037j), (1.0547438307594135+0.5951050387699504j), (1.035431531933363+0.6281051650580145j), (1.0150870924380768+0.660479182457735j), (0.9937307920532863+0.6921948198445108j), (0.9713839192036653+0.7232204623812533j), (0.9480687497380627+0.7535251830327458j), (0.923808524724451+0.7830787733943885j), (0.8986274272827277+0.8118517738045857j), (0.8725505584784514+0.8398155027107852j), (0.8456039123015575+0.8669420852598667j), (0.8178143497549824+0.8932044810844054j), (0.7892095720790281+0.9185765112570992j), (0.7598180931381708+0.9430328843864885j), (0.7296692109978129+0.9665492218279708j), (0.6987929787193408+0.9891020819849576j), (0.6672201744025733+1.010668983675974j), (0.634982270505489+1.0312284285443842j), (0.6021114024717921+1.0507599224884236j), (0.5686403366976007+1.0692439960901654j), (0.5346024378691977+1.0866622240230575j), (0.5000316357043777+1.102997243418691j), (0.46496239113057336+1.1182327711744842j), (0.42942966193345056+1.1323536201850326j), (0.39346886791022445+1.1453457144809478j), (0.35711585556244224+1.1571961032600877j), (0.3204068623634029+1.1678929737971995j), (0.28337848063586246+1.1774256632190996j), (0.24606762107600863+1.1857846691336587j), (0.20851147596007313+1.1929616591019923j), (0.17074748207026338+1.198949478944418j), (0.1328132833769713+1.203742159871895j), (0.09474669351443182+1.2073349244358456j), (0.056585658087276836+1.2097241912904182j), (0.01836821684553752+1.2109075787624513j), (-0.01986753423421911+1.2108839072255766j), (-0.05808348092377885+1.2096532002760971j), (-0.09624152873637654+1.207216684709465j), (-0.13430364090010044+1.2035767892973857j), (-0.17223187627378606+1.198737142366765j), (-0.20998842716756522+1.192702568182914j), (-0.2475356570303862+1.1854790821406178j), (-0.28483613796695995+1.1770738847678566j), (-0.3218526880466929+1.1674953545481648j), (-0.3585484083674385+1.1567530395687764j), (-0.39488671983713725+1.144857648002883j), (-0.43083139963664313+1.1318210374354938j), (-0.4663466173274217+1.1176562030435377j), (-0.5013969705681022+1.10237726464199j), (-0.5359475204043134+1.0859994526089296j), (-0.5699638260965869+1.0685390927035687j), (-0.6034119794516304+1.0500135897923855j), (-0.6362586386227624+1.0304414104995663j), (-0.6684710613457853+1.0098420647990782j), (-0.7000171375771805+0.9882360865667056j), (-0.7308654215021095+0.9656450131114283j), (-0.760985162880278+0.9420913637065691j), (-0.7903463376984481+0.9175986171420906j), (-0.8189196780990214+0.8921911883204303j), (-0.8466767015548853+0.8658944039191883j), (-0.8735897392614098+0.8387344771449475j), (-0.899631963717311+0.8107384816033842j), (-0.9247774154668957+0.7819343243117003j), (-0.9490010289770063+0.7523507178803045j), (-0.972278657622887+0.7220171518914655j), (-0.9945870977580707+0.690963863503443j), (-1.0159041118442746+0.6592218073094382j), (-1.0362084506182636+0.626822624481379j), (-1.0554798742735743+0.5937986112293179j), (-1.0736991726359992+0.5601826866078575j), (-1.0908481843127054+0.5260083597017262j), (-1.1069098147959002+0.49130969622319914j), (-1.1218680535030168+0.4561212845546442j), (-1.135707989736405+0.42047820127007807j), (-1.148415827546642+0.3844159761700701j), (-1.1599788994846314+0.34797055686487277j), (-1.1703856792287968+0.3111782729410498j), (-1.1796257930747662+0.2740757997473603j), (-1.1876900302761064+0.23670012183597933j), (-1.1945703522257978+0.19908849609548038j), (-1.2002599004692895+0.16127841461236378j), (-1.2047530035411582+0.12330756729813686j), (-1.2080451826185472+0.08521380431917702j), (-1.2101331559857558+0.0470350983668717j), (-1.211014842305522+0.008809506805609046j), (-1.2106893626937485-0.029424866263621285j), (-1.2091570415955901-0.0676299079862383j), (-1.2064194064620422-0.1057675347457851j), (-1.2024791862273427-0.14379973012649944j), (-1.1973403085887127-0.18168858280891725j), (-1.19100789609114-0.21939632436069306j), (-1.1834882610211186-0.25688536688498903j), (-1.1747888991144197-0.29411834048892027j), (-1.164918482084183-0.33105813053466887j), (-1.1538868489767617-0.3676679146361653j), (-1.1417049963639507-0.4039111993644363j), (-1.128385067381361-0.4397518566250605j), (-1.1139403396238785-0.47515415967143226j), (-1.0983852119102722-0.510082818717954j), (-1.0817351899301337-0.5445030161176738j), (-1.0640068707874724-0.5783804410692652j), (-1.045217926456357-0.6116813238187839j), (-1.0253870861651149-0.6443724693220851j), (-1.0045341177266216-0.6764212903343777j), (-0.9826798078333181-0.7077958398938917j), (-0.9598459413365887-0.7384648431672997j), (-0.9360552795311391-0.7683977286251616j), (-0.9113315374660464-0.797564658516285j), (-0.8856993603050877-0.8259365586106387j), (-0.8591842987598948-0.853485147181188j), (-0.8318127836204566-0.880182963195729j), (-0.8036120994083287-0.9060033936906445j), (-0.7746103571788353-0.930920700299281j), (-0.7448364664993494-0.9549100449085193j), (-0.7143201066316105-0.977947514417942j), (-0.6830916969467975-1.0000101445769292j), (-0.6511823666028271-1.021075942875929j), (-0.6186239235141375-1.0411239104690666j), (-0.5854488226448729-1.0601340631062464j), (-0.5516901336570581-1.078087451053895j), (-0.5173815079460486-1.0949661779844615j), (-0.48255714509608355-1.1107534188158703j), (-0.4472517587894035-1.125433436483123j), (-0.41150054220288634-1.1389915976253544j), (-0.37533913292672855-1.15141438717268j), (-0.3388035774401264-1.1626894218183113j), (-0.30193029517934944-1.1728054623625086j), (-0.2647560422340627-1.1817524249160571j), (-0.2273178747080525-1.1895213909521092j), (-0.18965311178090527-1.1961046161963618j), (-0.15179929850742488-1.2014955383467223j), (-0.11379416839191175-1.2056887836147516j), (-0.0756756057745917-1.2086801720823732j), (-0.037481608067668704-1.2104667218685066j), (0.0007497521213151725-1.2110466521014716j), (0.038980364941077095-1.2104193846942004j), (0.07717212128533435-1.2085855449204859j), (0.11528695078078188-1.2055469607916964j), (0.1532868597364727-1.201306661234573j), (0.19113396901674673-1.1958688730719316j), (0.22879055179998975-1.1892390168092715j), (0.2662190711855433-1.1814237012314985j), (0.303382217611297-1.1724307168151464j), (0.3402429460446848-1.1622690279626573j), (0.3767645129099721-1.1509487640664715j), (0.412910512715045-1.138481209411831j), (0.44864491434120907-1.1248787919283552j), (0.4839320969597841-1.1101550708016124j), (0.5187368855397247-1.0943247229570265j), (0.5530245859108478-1.0774035284296046j), (0.5867610193477484-1.0594083546340465j), (0.6199125566398904-1.0403571395509434j), (0.6524461516139289-1.0202688738458114j), (0.6843293740748666-0.9991635819387772j), (0.715530442133171-0.9770623020438028j), (0.7460182538856477-0.9539870651973411j), (0.7757624184185056-0.9299608732973114j), (0.8047332861016724-0.9050076761743131j), (0.8329019781441949-0.8791523477179105j), (0.8602404153812387-0.8524206610818044j), (0.8867213462640212-0.8248392629925836j), (0.9123183740247413-0.7964356471876926j), (0.9370059829894494-0.7672381270090808j), (0.9607595640126328-0.7372758071798382j), (0.9835554390081436-0.706578554791981j), (1.0053708845520304-0.6751769695342803j), (1.026184154533738-0.6431023531898354j), (1.04597450183311-0.6103866784337647j), (1.0647221990015658-0.5770625569621519j), (1.0824085579268474-0.5431632069840051j), (1.0990159484617423-0.508722420108612j), (1.1145278159981948-0.4737745276613343j), (1.1289286979692956-0.4383543664614021j)], [(1.1399425195654302-0.40885890938225256j), (1.1394892330341173-0.4086814119837466j), (1.1390482236921429-0.4084752936530779j), (1.1386212965024016-0.40824139799128434j), (1.1382101987923592-0.407980682286456j), (1.1378166131025924-0.4076942135957463j), (1.1374421503004863-0.40738316437812133j), (1.1370883429872782-0.4070488076957196j), (1.1367566392254265-0.4066925120034643j), (1.136448396611982-0.40631573554825084j), (1.1361648767222148-0.4059200204006351j), (1.135907239946239-0.40550698614344677j), (1.1356765407397695-0.40507832324316206j), (1.1354737233084444-0.40463578613116247j), (1.1352996177433823-0.40418118602319875j), (1.1351549366237843-0.40371638350644773j), (1.1350402721004904-0.4032432809245017j), (1.134956093472425-0.40276381459145705j), (1.1349027452658502-0.4022799468669687j), (1.1348804458242887-0.40179365812470513j), (1.1348892864148883-0.4013069386470755j), (1.134929230854882-0.4008217804794025j), (1.135000115659679-0.40034016927688004j), (1.1351016507119724-0.3998640761776841j), (1.135233420449133-0.39939544973549923j), (1.1353948855640226-0.3989362079444784j), (1.13558538521227-0.3984882303892775j), (1.135804139716976-0.3980533505522914j), (1.1360502537597736-0.39763334830957825j), (1.1363227200451869-0.397229942646183j), (1.1366204234232897-0.39684478462067607j), (1.1369421454537911-0.39647945060770134j), (1.1372865693928675-0.3961354358461906j), (1.137652285582331-0.39581414831965j), (1.138037797219078-0.3955169029935657j), (1.1384415264812044-0.39524491643351334j), (1.138861820985715-0.3949993018259992j), (1.139296960551396-0.3947810644224105j), (1.139745164239172-0.3945910974247231j), (1.1402045976411324-0.3944301783298045j), (1.140673380388396-0.39429896574727497j), (1.1411495938470848-0.3941979967039505j), (1.141631288970907-0.39412768444589935j), (1.1421164942782132-0.39408831674710887j), (1.1426032239208768-0.39408005473168406j), (1.1430894858119713-0.39410293221439907j), (1.143573289778984-0.39415685556229996j), (1.1440526557091935-0.3942416040779255j), (1.1445256216538733-0.3943568309025782j), (1.1449902518581556-0.3945020644359467j), (1.1543412065301706-0.3662389037239172j), (1.1653275013787483-0.32961548844796384j), (1.1751521724308143-0.29266350528476254j), (1.1838054262406001-0.25541978877474913j), (1.1912786370565205-0.2179214642645043j), (1.197564355419509-0.18020591089940025j), (1.202656315588802-0.14231072436325626j), (1.2065494417877642-0.10427367940214272j), (1.2092398532635347-0.06613269216969336j), (1.2107248681554441-0.0279257824314586j), (1.2110030061683523+0.010308964334024118j), (1.2100739900482393+0.04853343489966294j), (1.2079387458585777+0.08670952628190554j), (1.2045994020572124+0.12479918372262161j), (1.2000592873746672+0.16276443862291373j), (1.1943229274959948+0.20056744639104207j), (1.1873960405494741+0.23817052416673679j), (1.1792855314066575+0.2755361883842922j), (1.1699994847994426+0.31262719213700096j), (1.1595471572610376+0.34940656230567996j), (1.1479389678988463+0.38583763641428026j), (1.2110207171111118-0.007961056595376418j), (1.2105342227713707-0.007943815268687433j), (1.21004982644287-0.007895501679693257j), (1.209569510662749-0.007816313566235515j), (1.2090952412672793-0.0077065750293996964j), (1.208628959346091-0.007566735207034354j), (1.2081725732976825-0.0073973664355198475j), (1.207727951018727-0.00719916190731019j), (1.2072969122591464-0.0069729328338352025j), (1.206881221174238-0.006719605125374622j), (1.2064825791043416-0.006440215601492812j), (1.2061026176115937-0.006135907747543974j), (1.2057428918022703-0.00580792703461566j), (1.2054048739620493-0.0054576158220650955j), (1.2050899475302395-0.005086407863511243j), (1.2047994014376402-0.004695822438768432j), (1.2045344248312067-0.004287458135738433j), (1.204296102207109-0.0038629863077103946j), (1.2040854089721074-0.003424144232846641j), (1.2039032074514062-0.0029727280038511577j), (1.2037502433593321-0.002510585176921953j), (1.2036271427472716-0.0020396072100736322j), (1.2035344094413707-0.0015617217217786432j), (1.2034724229804743-0.001078884601611008j), (1.2034414370627498-0.0005930720051820961j), (1.2034415785073511-0.00010627226613156885j), (1.2034728467353741+0.00037952224172390085j), (1.203535113772225+0.0008623232587775592j), (1.2036281247713954+0.0013401547771808501j), (1.2037514990574971+0.0018110611282477068j), (1.2039047316842917+0.002273114986614731j), (1.204087195501333+0.0027244252583978152j), (1.2042981437207692+0.0031631448210606007j), (1.2045367129737945+0.003587478083316999j), (1.2048019268442465+0.003995688334126628j), (1.205092699864881+0.004386104850705224j), (1.2054078419599716+0.004757129736458291j), (1.2057460633160524+0.0051072444608518015j), (1.2061059796608649+0.005435016074453463j), (1.206486117928908+0.005739103073707703j), (1.2068849222903995+0.006018260891440996j), (1.2073007605189758+0.006271346990625986j), (1.207731930672068+0.0064973255405566845j), (1.2081766680566106+0.006695271656296031j), (1.2086331524515785+0.00686437518404468j), (1.2090995155577855+0.007003944016938222j), (1.2095738486444592+0.007113406927701916j), (1.210054210361294+0.007192315906569515j), (1.210538634684008+0.007240347994897486j), (1.2110251389608884+0.007257306606970045j), (1.1351864880084754+0.42188409917583986j), (1.1213024295392167+0.4575100186923523j), (1.1063006324224978+0.4926798822724633j), (1.0901960507759383+0.5273586318312944j), (1.0730047379967604+0.5615116988371036j), (1.0547438307594135+0.5951050387699508j), (1.0354315319333631+0.6281051650580144j), (1.0150870924380764+0.6604791824577354j), (0.9937307920532863+0.6921948198445108j), (0.9713839192036653+0.7232204623812529j), (0.9480687497380624+0.7535251830327461j), (0.923808524724451+0.7830787733943884j), (0.8986274272827275+0.8118517738045861j), (0.8725505584784514+0.8398155027107852j), (0.8456039123015577+0.8669420852598667j), (0.8178143497549821+0.8932044810844058j), (0.7892095720790283+0.918576511257099j), (0.7598180931381704+0.9430328843864889j), (0.7296692109978128+0.9665492218279708j), (0.6987929787193403+0.9891020819849577j), (0.6672201744025732+1.0106689836759741j), (0.6349822705054893+1.0312284285443842j), (0.6021114024717917+1.0507599224884239j), (0.5686403366976007+1.0692439960901654j), (0.5346024378691971+1.0866622240230577j), (0.5000316357043775+1.1029972434186912j), (0.4649623911305736+1.1182327711744842j), (0.4294296619334503+1.1323536201850326j), (0.39346886791022445+1.1453457144809478j), (0.3571158555624417+1.157196103260088j), (0.32040686236340254+1.1678929737971995j), (0.2833784806358627+1.1774256632190996j), (0.24606762107600838+1.1857846691336587j), (0.2085114759600721+1.1929616591019927j), (0.1707474820702639+1.1989494789444182j), (0.13281328337697124+1.203742159871895j), (0.09474669351443099+1.2073349244358456j), (0.056585658087277724+1.2097241912904182j), (0.018368216845537688+1.210907578762451j), (-0.019867534234219664+1.2108839072255764j), (-0.05808348092378002+1.2096532002760971j), (-0.09624152873637631+1.207216684709465j), (-0.13430364090010072+1.2035767892973857j), (-0.1722318762737869+1.1987371423667648j), (-0.2099884271675645+1.1927025681829142j), (-0.2475356570303865+1.1854790821406176j), (-0.2848361379669607+1.1770738847678563j), (-0.3218526880466921+1.1674953545481648j), (-0.35854840836743834+1.1567530395687764j), (-0.3948867198371375+1.1448576480028827j), (-0.4308313996366444+1.1318210374354933j), (-0.4663466173274215+1.117656203043538j), (-0.5013969705681025+1.10237726464199j), (-0.535947520404314+1.0859994526089292j), (-0.5699638260965862+1.0685390927035692j), (-0.6034119794516302+1.0500135897923855j), (-0.636258638622763+1.0304414104995658j), (-0.6684710613457845+1.0098420647990787j), (-0.7000171375771804+0.9882360865667057j), (-0.7308654215021098+0.965645013111428j), (-0.7609851628802787+0.9420913637065687j), (-0.7903463376984481+0.9175986171420908j), (-0.8189196780990218+0.8921911883204301j), (-0.8466767015548857+0.8658944039191878j), (-0.8735897392614094+0.8387344771449481j), (-0.8996319637173107+0.8107384816033846j), (-0.9247774154668957+0.7819343243117j), (-0.9490010289770059+0.7523507178803052j), (-0.9722786576228867+0.7220171518914658j), (-0.9945870977580709+0.6909638635034427j), (-1.015904111844275+0.6592218073094376j), (-1.0362084506182632+0.6268226244813796j), (-1.0554798742735743+0.5937986112293177j), (-1.0736991726359997+0.5601826866078568j), (-1.090848184312705+0.5260083597017269j), (-1.1069098147959002+0.49130969622319937j), (-1.121868053503017+0.45612128455464396j), (-1.1357079897364055+0.4204782012700768j), (-1.148415827546642+0.38441597617007034j), (-1.1599788994846316+0.34797055686487255j), (-1.170385679228797+0.31117827294104905j), (-1.1796257930747662+0.27407579974736107j), (-1.1876900302761066+0.23670012183597905j), (-1.1945703522257978+0.19908849609547952j), (-1.2002599004692895+0.16127841461236456j), (-1.2047530035411582+0.12330756729813708j), (-1.2080451826185474+0.0852138043191768j), (-1.2101331559857558+0.047035098366870864j), (-1.211014842305522+0.008809506805609324j), (-1.2106893626937483-0.029424866263621507j), (-1.20915704159559-0.06762990798623914j), (-1.2064194064620422-0.10576753474578432j), (-1.2024791862273427-0.14379973012649921j), (-1.1973403085887124-0.18168858280891814j), (-1.1910078960911403-0.21939632436069229j), (-1.1834882610211186-0.2568853668849888j), (-1.1747888991144195-0.29411834048892055j), (-1.1649184820841825-0.3310581305346697j), (-1.153886848976762-0.36766791463616444j), (-1.1417049963639507-0.40391119936443654j), (-1.1283850673813607-0.4397518566250613j), (-1.1139403396238787-0.47515415967143154j), (-1.0983852119102722-0.5100828187179538j), (-1.0817351899301337-0.544503016117674j), (-1.0640068707874715-0.5783804410692666j), (-1.0452179264563575-0.6116813238187832j), (-1.0253870861651149-0.6443724693220856j), (-1.0045341177266207-0.6764212903343789j), (-0.9826798078333185-0.707795839893891j), (-0.9598459413365885-0.7384648431672998j), (-0.936055279531139-0.7683977286251618j), (-0.9113315374660471-0.7975646585162844j), (-0.8856993603050876-0.8259365586106391j), (-0.8591842987598945-0.8534851471811883j), (-0.8318127836204556-0.8801829631957299j), (-0.8036120994083291-0.9060033936906441j), (-0.7746103571788352-0.9309207002992811j), (-0.7448364664993482-0.9549100449085199j), (-0.7143201066316112-0.9779475144179416j), (-0.6830916969467973-1.0000101445769296j), (-0.6511823666028269-1.0210759428759293j), (-0.6186239235141382-1.0411239104690662j), (-0.5854488226448725-1.0601340631062466j), (-0.5516901336570578-1.078087451053895j), (-0.5173815079460475-1.0949661779844622j), (-0.4825571450960843-1.1107534188158699j), (-0.4472517587894032-1.125433436483123j), (-0.41150054220288607-1.1389915976253544j), (-0.37533913292672927-1.1514143871726796j), (-0.3388035774401261-1.1626894218183115j), (-0.3019302951793492-1.1728054623625086j), (-0.26475604223406135-1.1817524249160576j), (-0.22731787470805323-1.189521390952109j), (-0.189653111780905-1.196104616196362j), (-0.15179929850742352-1.2014955383467225j), (-0.11379416839191248-1.2056887836147516j), (-0.07567560577459143-1.208680172082373j), (-0.03748160806766848-1.2104667218685066j), (0.0007497521213145064-1.2110466521014716j), (0.03898036494107743-1.2104193846942006j), (0.07717212128533468-1.208585544920486j), (0.11528695078078322-1.2055469607916962j), (0.15328685973647194-1.2013066612345733j), (0.19113396901674712-1.1958688730719316j), (0.2287905517999912-1.1892390168092712j), (0.2662190711855425-1.1814237012314988j), (0.3033822176112973-1.1724307168151464j), (0.34024294604468525-1.1622690279626573j), (0.3767645129099713-1.1509487640664715j), (0.4129105127150451-1.138481209411831j), (0.4486449143412093-1.1248787919283552j), (0.48393209695978545-1.1101550708016117j), (0.518736885539724-1.094324722957027j), (0.553024585910848-1.0774035284296044j), (0.5867610193477486-1.0594083546340465j), (0.6199125566398896-1.0403571395509439j), (0.6524461516139293-1.0202688738458114j), (0.6843293740748669-0.9991635819387772j), (0.7155304421331703-0.9770623020438034j), (0.746018253885647-0.9539870651973417j), (0.7757624184185057-0.9299608732973113j), (0.8047332861016734-0.9050076761743122j), (0.8329019781441942-0.8791523477179111j), (0.8602404153812389-0.8524206610818041j), (0.8867213462640213-0.8248392629925834j), (0.9123183740247408-0.7964356471876932j), (0.9370059829894495-0.7672381270090806j), (0.9607595640126332-0.737275807179838j), (0.9835554390081445-0.7065785547919798j), (1.00537088455203-0.6751769695342809j), (1.026184154533738-0.6431023531898352j), (1.0459745018331106-0.6103866784337635j), (1.0647221990015652-0.5770625569621526j), (1.0824085579268474-0.5431632069840049j), (1.0990159484617426-0.5087224201086118j), (1.1145278159981946-0.4737745276613351j), (1.1289286979692958-0.4383543664614018j), (1.142204239262712-0.40249724409580234j), (1.1543412065301706-0.36623890372391704j), (1.165327501378748-0.3296154884479643j), (1.1751521724308143-0.2926635052847626j), (1.1838054262406001-0.25541978877474875j), (1.1912786370565205-0.21792146426450454j), (1.1975643554195088-0.1802059108994001j), (1.202656315588802-0.1423107243632567j), (1.2065494417877645-0.10427367940214283j), (1.2092398532635347-0.06613269216969297j), (1.210724868155444-0.027925782431458768j), (1.2110030061683523+0.010308964334024395j), (1.2100739900482396+0.0485334348996625j), (1.2079387458585777+0.08670952628190554j), (1.2045994020572126+0.124799183722621j), (1.2000592873746672+0.16276443862291362j), (1.1943229274959948+0.20056744639104235j), (1.1873960405494743+0.2381705241667364j), (1.1792855314066575+0.2755361883842922j), (1.1699994847994428+0.31262719213700035j), (1.1595471572610376+0.34940656230567985j), (1.1479389678988459+0.3858376364142804j), (1.1351864880084754+0.4218840991758396j), (1.1213024295392167+0.45751001869235247j), (1.1063006324224978+0.4926798822724628j), (1.0901960507759383+0.5273586318312941j), (1.0730047379967602+0.5615116988371037j), (1.0547438307594135+0.5951050387699504j), (1.035431531933363+0.6281051650580145j), (1.0150870924380768+0.660479182457735j), (0.9937307920532863+0.6921948198445108j), (0.9713839192036653+0.7232204623812533j), (0.9480687497380627+0.7535251830327458j), (0.923808524724451+0.7830787733943885j), (0.8986274272827277+0.8118517738045857j), (0.8725505584784514+0.8398155027107852j), (0.8456039123015575+0.8669420852598667j), (0.8178143497549824+0.8932044810844054j), (0.7892095720790281+0.9185765112570992j), (0.7598180931381708+0.9430328843864885j), (0.7296692109978129+0.9665492218279708j), (0.6987929787193408+0.9891020819849576j), (0.6672201744025733+1.010668983675974j), (0.634982270505489+1.0312284285443842j), (0.6021114024717921+1.0507599224884236j), (0.5686403366976007+1.0692439960901654j), (0.5346024378691977+1.0866622240230575j), (0.5000316357043777+1.102997243418691j), (0.46496239113057336+1.1182327711744842j), (0.42942966193345056+1.1323536201850326j), (0.39346886791022445+1.1453457144809478j), (0.35711585556244224+1.1571961032600877j), (0.3204068623634029+1.1678929737971995j), (0.28337848063586246+1.1774256632190996j), (0.24606762107600863+1.1857846691336587j), (0.20851147596007313+1.1929616591019923j), (0.17074748207026338+1.198949478944418j), (0.1328132833769713+1.203742159871895j), (0.09474669351443182+1.2073349244358456j), (0.056585658087276836+1.2097241912904182j), (0.01836821684553752+1.2109075787624513j), (-0.01986753423421911+1.2108839072255766j), (-0.05808348092377885+1.2096532002760971j), (-0.09624152873637654+1.207216684709465j), (-0.13430364090010044+1.2035767892973857j), (-0.17223187627378606+1.198737142366765j), (-0.20998842716756522+1.192702568182914j), (-0.2475356570303862+1.1854790821406178j), (-0.28483613796695995+1.1770738847678566j), (-0.3218526880466929+1.1674953545481648j), (-0.3585484083674385+1.1567530395687764j), (-0.39488671983713725+1.144857648002883j), (-0.43083139963664313+1.1318210374354938j), (-0.4663466173274217+1.1176562030435377j), (-0.5013969705681022+1.10237726464199j), (-0.5359475204043134+1.0859994526089296j), (-0.5699638260965869+1.0685390927035687j), (-0.6034119794516304+1.0500135897923855j), (-0.6362586386227624+1.0304414104995663j), (-0.6684710613457853+1.0098420647990782j), (-0.7000171375771805+0.9882360865667056j), (-0.7308654215021095+0.9656450131114283j), (-0.760985162880278+0.9420913637065691j), (-0.7903463376984481+0.9175986171420906j), (-0.8189196780990214+0.8921911883204303j), (-0.8466767015548853+0.8658944039191883j), (-0.8735897392614098+0.8387344771449475j), (-0.899631963717311+0.8107384816033842j), (-0.9247774154668957+0.7819343243117003j), (-0.9490010289770063+0.7523507178803045j), (-0.972278657622887+0.7220171518914655j), (-0.9945870977580707+0.690963863503443j), (-1.0159041118442746+0.6592218073094382j), (-1.0362084506182636+0.626822624481379j), (-1.0554798742735743+0.5937986112293179j), (-1.0736991726359992+0.5601826866078575j), (-1.0908481843127054+0.5260083597017262j), (-1.1069098147959002+0.49130969622319914j), (-1.1218680535030168+0.4561212845546442j), (-1.135707989736405+0.42047820127007807j), (-1.148415827546642+0.3844159761700701j), (-1.1599788994846314+0.34797055686487277j), (-1.1703856792287968+0.3111782729410498j), (-1.1796257930747662+0.2740757997473603j), (-1.1876900302761064+0.23670012183597933j), (-1.1945703522257978+0.19908849609548038j), (-1.2002599004692895+0.16127841461236378j), (-1.2047530035411582+0.12330756729813686j), (-1.2080451826185472+0.08521380431917702j), (-1.2101331559857558+0.0470350983668717j), (-1.211014842305522+0.008809506805609046j), (-1.2106893626937485-0.029424866263621285j), (-1.2091570415955901-0.0676299079862383j), (-1.2064194064620422-0.1057675347457851j), (-1.2024791862273427-0.14379973012649944j), (-1.1973403085887127-0.18168858280891725j), (-1.19100789609114-0.21939632436069306j), (-1.1834882610211186-0.25688536688498903j), (-1.1747888991144197-0.29411834048892027j), (-1.164918482084183-0.33105813053466887j), (-1.1538868489767617-0.3676679146361653j), (-1.1417049963639507-0.4039111993644363j), (-1.128385067381361-0.4397518566250605j), (-1.1139403396238785-0.47515415967143226j), (-1.0983852119102722-0.510082818717954j), (-1.0817351899301337-0.5445030161176738j), (-1.0640068707874724-0.5783804410692652j), (-1.045217926456357-0.6116813238187839j), (-1.0253870861651149-0.6443724693220851j), (-1.0045341177266216-0.6764212903343777j), (-0.9826798078333181-0.7077958398938917j), (-0.9598459413365887-0.7384648431672997j), (-0.9360552795311391-0.7683977286251616j), (-0.9113315374660464-0.797564658516285j), (-0.8856993603050877-0.8259365586106387j), (-0.8591842987598948-0.853485147181188j), (-0.8318127836204566-0.880182963195729j), (-0.8036120994083287-0.9060033936906445j), (-0.7746103571788353-0.930920700299281j), (-0.7448364664993494-0.9549100449085193j), (-0.7143201066316105-0.977947514417942j), (-0.6830916969467975-1.0000101445769292j), (-0.6511823666028271-1.021075942875929j), (-0.6186239235141375-1.0411239104690666j), (-0.5854488226448729-1.0601340631062464j), (-0.5516901336570581-1.078087451053895j), (-0.5173815079460486-1.0949661779844615j), (-0.48255714509608355-1.1107534188158703j), (-0.4472517587894035-1.125433436483123j), (-0.41150054220288634-1.1389915976253544j), (-0.37533913292672855-1.15141438717268j), (-0.3388035774401264-1.1626894218183113j), (-0.30193029517934944-1.1728054623625086j), (-0.2647560422340627-1.1817524249160571j), (-0.2273178747080525-1.1895213909521092j), (-0.18965311178090527-1.1961046161963618j), (-0.15179929850742488-1.2014955383467223j), (-0.11379416839191175-1.2056887836147516j), (-0.0756756057745917-1.2086801720823732j), (-0.037481608067668704-1.2104667218685066j), (0.0007497521213151725-1.2110466521014716j), (0.038980364941077095-1.2104193846942004j), (0.07717212128533435-1.2085855449204859j), (0.11528695078078188-1.2055469607916964j), (0.1532868597364727-1.201306661234573j), (0.19113396901674673-1.1958688730719316j), (0.22879055179998975-1.1892390168092715j), (0.2662190711855433-1.1814237012314985j), (0.303382217611297-1.1724307168151464j), (0.3402429460446848-1.1622690279626573j), (0.3767645129099721-1.1509487640664715j), (0.412910512715045-1.138481209411831j), (0.44864491434120907-1.1248787919283552j), (0.4839320969597841-1.1101550708016124j), (0.5187368855397247-1.0943247229570265j), (0.5530245859108478-1.0774035284296046j), (0.5867610193477484-1.0594083546340465j), (0.6199125566398904-1.0403571395509434j), (0.6524461516139289-1.0202688738458114j), (0.6843293740748666-0.9991635819387772j), (0.715530442133171-0.9770623020438028j), (0.7460182538856477-0.9539870651973411j), (0.7757624184185056-0.9299608732973114j), (0.8047332861016724-0.9050076761743131j), (0.8329019781441949-0.8791523477179105j), (0.8602404153812387-0.8524206610818044j), (0.8867213462640212-0.8248392629925836j), (0.9123183740247413-0.7964356471876926j), (0.9370059829894494-0.7672381270090808j), (0.9607595640126328-0.7372758071798382j), (0.9835554390081436-0.706578554791981j), (1.0053708845520304-0.6751769695342803j), (1.026184154533738-0.6431023531898354j), (1.04597450183311-0.6103866784337647j), (1.0647221990015658-0.5770625569621519j), (1.0824085579268474-0.5431632069840051j), (1.0990159484617423-0.508722420108612j), (1.1145278159981948-0.4737745276613343j), (1.1289286979692956-0.4383543664614021j)])\n"
     ]
    }
   ],
   "source": [
    "print(result)\n",
    "# print(len(result))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "outer_loop, inner_loop = result\n",
    "outer_loop = np.array(outer_loop)\n",
    "inner_loop = np.array(inner_loop)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x7f12e466b070>]"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "plt.plot(outer_loop.real, outer_loop.imag)\n",
    "plt.plot(inner_loop.real, inner_loop.imag)\n",
    "plt.plot(beta0.real, beta0.imag, 'x')\n",
    "plt.plot((beta0*curr_param[0]).real, (beta0*curr_param[0]).imag, 'x')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(1.142204239262712-0.40249724409580206j)"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# plot result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "with open(\"data/minimal_model_test.pkl\", \"rb\") as fp:\n",
    "    data = pickle.load(fp)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [],
   "source": [
    "all_segments, GBZ_points, GBZ_params, non_GBZ_points, non_GBZ_params = data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "for seg in all_segments:\n",
    "    plt.plot(seg[:,0].real, seg[:,0].imag, '.')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [],
   "source": [
    "fig = plt.figure()\n",
    "ax= fig.add_subplot(projection='3d')\n",
    "for seg in all_segments:\n",
    "    ax.plot(seg[:,1].real, seg[:,1].imag, seg[:,0].real)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "fig = plt.figure()\n",
    "ax = fig.gca()\n",
    "for j in range(50):\n",
    "    if(os.path.exists(\"data/GBZ_data_6/x_major_%d.pkl\"%(j))):\n",
    "        with open(\"data/GBZ_data_6/x_major_%d.pkl\"%(j), \"rb\") as fp:\n",
    "            all_segments = pickle.load(fp)\n",
    "        for seg in all_segments:\n",
    "            ax.plot(seg[:,0].real, seg[:,0].imag)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Y major debug"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "+(-1+0*i)*(z**2)+(-1+0*i)*y*z+(-0.100000000000000006+0*i)*y*(z**2)+(-1+0*i)*(y**3)+(-1+0*i)*(y**3)*z+(-0.100000000000000006+0*i)*(y**4)+(1+0*i)*x*(y**2)*z;\n"
     ]
    }
   ],
   "source": [
    "print(char_poly.num.to_str(csolver.CStrVec(['x', 'y', 'z'])))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [],
   "source": [
    "which_var = 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [],
   "source": [
    "with open(\"data/minimal_model_test.pkl\", \"rb\") as fp:\n",
    "    data = pickle.load(fp)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [],
   "source": [
    "all_segments, GBZ_points, GBZ_params, non_GBZ_points, non_GBZ_params = data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "4\n"
     ]
    }
   ],
   "source": [
    "print(len(all_segments))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "fig = plt.figure()\n",
    "ax = fig.add_subplot(projection='3d')\n",
    "for seg in all_segments:\n",
    "    ax.plot(seg[:,2].real, seg[:,2].imag, seg[:,0].real)\n",
    "    plt.pause(1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[-0.03355522-0.01039632j  0.72733093-1.54099378j]\n",
      "[-0.03355522-0.01039632j  0.72733093-1.54099378j]\n",
      "[-0.03355522-0.01039632j  0.72733093-1.54099378j]\n",
      "[-0.03355522-0.01039632j  0.72733093-1.54099378j]\n",
      "[-0.03355522-0.01039632j  0.72733093-1.54099378j]\n",
      "[-0.03355522-0.01039632j  0.72733093-1.54099378j]\n",
      "[-0.03336102-0.02124416j  0.74296778-1.53334216j]\n",
      "[-0.03352175-0.02124975j  0.74305715-1.53351742j]\n",
      "[-0.03352189-0.02124534j  0.74305318-1.53351941j]\n",
      "[-0.03352182-0.02124534j  0.74305315-1.53351937j]\n",
      "[-0.03352182-0.02124534j  0.74305315-1.53351937j]\n",
      "[-0.03355522-0.01039632j  0.72733093-1.54099378j]\n",
      "[-0.03352182-0.02124534j  0.74305315-1.53351937j]\n",
      "[-0.03352182-0.02124534j  0.74305315-1.53351937j]\n",
      "[-0.03330472-0.03209044j  0.75862205-1.52573383j]\n",
      "[-0.03346541-0.03209565j  0.75871235-1.52590856j]\n",
      "[-0.03346552-0.03209124j  0.75870839-1.52591057j]\n",
      "[-0.03346545-0.03209124j  0.75870837-1.52591053j]\n",
      "[-0.03346545-0.03209124j  0.75870837-1.52591053j]\n",
      "[-0.03352182-0.02124534j  0.74305315-1.53351937j]\n",
      "[-0.03346545-0.03209124j  0.75870837-1.52591053j]\n",
      "[-0.03346545-0.03209124j  0.75870837-1.52591053j]\n",
      "[-0.03322541-0.04293201j  0.77420718-1.51799218j]\n",
      "[-0.03338601-0.04293684j  0.77429839-1.51816635j]\n",
      "[-0.03338611-0.04293243j  0.77429444-1.51816837j]\n",
      "[-0.03338604-0.04293243j  0.77429442-1.51816832j]\n",
      "[-0.03338604-0.04293243j  0.77429442-1.51816832j]\n",
      "[-0.03346545-0.03209124j  0.75870837-1.52591053j]\n",
      "[-0.03338604-0.04293243j  0.77429442-1.51816832j]\n",
      "[-0.03338604-0.04293243j  0.77429442-1.51816832j]\n",
      "[-0.03312297-0.05376728j  0.78972102-1.51011828j]\n",
      "[-0.03328346-0.05377173j  0.78981313-1.51029186j]\n",
      "[-0.03328353-0.05376733j  0.78980918-1.5102939j ]\n",
      "[-0.03328346-0.05376732j  0.78980916-1.51029385j]\n",
      "[-0.03328346-0.05376733j  0.78980916-1.51029385j]\n",
      "[-0.03338604-0.04293243j  0.77429442-1.51816832j]\n",
      "[-0.03328346-0.05376733j  0.78980916-1.51029385j]\n",
      "[-0.03328346-0.05376733j  0.78980916-1.51029385j]\n",
      "[-0.03299727-0.06459467j  0.80516145-1.50211327j]\n",
      "[-0.03315759-0.06459874j  0.80525443-1.50228623j]\n",
      "[-0.03315765-0.06459435j  0.8052505 -1.50228827j]\n",
      "[-0.03315757-0.06459435j  0.80525048-1.50228823j]\n",
      "[-0.03315757-0.06459435j  0.80525048-1.50228823j]\n",
      "[-0.03328346-0.05376733j  0.78980916-1.51029385j]\n",
      "[-0.03315757-0.06459435j  0.80525048-1.50228823j]\n",
      "[-0.03315757-0.06459435j  0.80525048-1.50228823j]\n",
      "[-0.03284811-0.07541261j  0.82052633-1.4939783j ]\n",
      "[-0.03300823-0.07541631j  0.82062017-1.49415059j]\n",
      "[-0.03300827-0.07541192j  0.82061625-1.49415265j]\n",
      "[-0.03300819-0.07541192j  0.82061623-1.49415261j]\n",
      "[-0.03300819-0.07541192j  0.82061623-1.49415261j]\n",
      "[-0.03315757-0.06459435j  0.80525048-1.50228823j]\n",
      "[-0.03300819-0.07541192j  0.82061623-1.49415261j]\n",
      "[-0.03300819-0.07541192j  0.82061623-1.49415261j]\n",
      "[-0.03267527-0.08621953j  0.83581355-1.48571452j]\n",
      "[-0.03283516-0.08622287j  0.83590823-1.48588613j]\n",
      "[-0.03283517-0.08621849j  0.83590433-1.4858882j ]\n",
      "[-0.0328351-0.08621849j  0.8359043-1.48588815j]\n",
      "[-0.0328351-0.08621849j  0.8359043-1.48588815j]\n",
      "[-0.03300819-0.07541192j  0.82061623-1.49415261j]\n",
      "[-0.0328351-0.08621849j  0.8359043-1.48588815j]\n",
      "[-0.0328351-0.08621849j  0.8359043-1.48588815j]\n",
      "[-0.03247852-0.09701387j  0.851021  -1.47732315j]\n",
      "[-0.03263813-0.09701686j  0.8511165 -1.47749404j]\n",
      "[-0.03263812-0.09701249j  0.85111261-1.47749612j]\n",
      "[-0.03263805-0.09701249j  0.85111259-1.47749607j]\n",
      "[-0.03263805-0.09701249j  0.85111259-1.47749607j]\n",
      "[-0.0328351-0.08621849j  0.8359043-1.48588815j]\n",
      "[-0.03263805-0.09701249j  0.85111259-1.47749607j]\n",
      "[-0.03263805-0.09701249j  0.85111259-1.47749607j]\n",
      "[-0.03225755-0.1077941j   0.86614658-1.46880542j]\n",
      "[-0.03241685-0.10779674j  0.86624288-1.46897555j]\n",
      "[-0.03241683-0.10779238j  0.86623901-1.46897764j]\n",
      "[-0.03241675-0.10779238j  0.86623898-1.4689776j ]\n",
      "[-0.03241675-0.10779238j  0.86623898-1.4689776j ]\n",
      "[-0.03263805-0.09701249j  0.85111259-1.47749607j]\n",
      "[-0.03241675-0.10779238j  0.86623898-1.4689776j ]\n",
      "[-0.03241675-0.10779238j  0.86623898-1.4689776j ]\n",
      "[-0.03201206-0.11855868j  0.88118817-1.46016258j]\n",
      "[-0.03217101-0.11856098j  0.88128525-1.46033192j]\n",
      "[-0.03217097-0.11855664j  0.8812814 -1.46033402j]\n",
      "[-0.0321709 -0.11855664j  0.88128138-1.46033398j]\n",
      "[-0.0321709 -0.11855664j  0.88128138-1.46033398j]\n",
      "[-0.03241675-0.10779238j  0.86623898-1.4689776j ]\n",
      "[-0.0321709 -0.11855664j  0.88128138-1.46033398j]\n",
      "[-0.0321709 -0.11855664j  0.88128138-1.46033398j]\n",
      "[-0.0317417 -0.1293061j   0.89614368-1.45139592j]\n",
      "[-0.03190027-0.12930807j  0.89624153-1.45156443j]\n",
      "[-0.03190021-0.12930374j  0.8962377 -1.45156654j]\n",
      "[-0.03190013-0.12930375j  0.89623768-1.4515665j ]\n",
      "[-0.03190013-0.12930375j  0.89623768-1.4515665j ]\n",
      "[-0.0321709 -0.11855664j  0.88128138-1.46033398j]\n",
      "[-0.03190013-0.12930375j  0.89623768-1.4515665j ]\n",
      "[-0.03190013-0.12930375j  0.89623768-1.4515665j ]\n",
      "[-0.03144609-0.14003485j  0.91101102-1.44250675j]\n",
      "[-0.03160423-0.14003651j  0.91110961-1.4426744j ]\n",
      "[-0.03160415-0.1400322j   0.9111058 -1.44267652j]\n",
      "[-0.03160408-0.1400322j   0.91110578-1.44267648j]\n",
      "[-0.03160408-0.1400322j   0.91110578-1.44267648j]\n",
      "[-0.03190013-0.12930375j  0.89623768-1.4515665j ]\n",
      "[-0.03160408-0.1400322j   0.91110578-1.44267648j]\n",
      "[-0.03160408-0.1400322j   0.91110578-1.44267648j]\n",
      "[-0.0311248 -0.15074346j  0.92578808-1.4334964j ]\n",
      "[-0.03128248-0.15074482j  0.9258874 -1.43366317j]\n",
      "[-0.03128239-0.15074053j  0.92588361-1.4336653j ]\n",
      "[-0.03128232-0.15074053j  0.92588358-1.43366526j]\n",
      "[-0.03128232-0.15074053j  0.92588358-1.43366526j]\n",
      "[-0.03160408-0.1400322j   0.91110578-1.44267648j]\n",
      "[-0.03128232-0.15074053j  0.92588358-1.43366526j]\n",
      "[-0.03128232-0.15074053j  0.92588358-1.43366526j]\n",
      "[-0.0307774 -0.16143047j  0.94047276-1.42436626j]\n",
      "[-0.03093458-0.16143154j  0.94057279-1.4245321j ]\n",
      "[-0.03093447-0.16142726j  0.94056902-1.42453424j]\n",
      "[-0.0309344-0.16142727j  0.940569 -1.4245342j ]\n",
      "[-0.0309344-0.16142727j  0.940569 -1.4245342j ]\n",
      "[-0.03128232-0.15074053j  0.92588358-1.43366526j]\n",
      "[-0.0309344-0.16142727j  0.940569 -1.4245342j ]\n",
      "[-0.0309344-0.16142727j  0.940569 -1.4245342j ]\n",
      "[-0.03040339-0.17209442j  0.95506298-1.4151177j ]\n",
      "[-0.03056005-0.17209522j  0.9551637 -1.41528259j]\n",
      "[-0.03055992-0.17209097j  0.95515995-1.41528473j]\n",
      "[-0.03055985-0.17209097j  0.95515993-1.41528469j]\n",
      "[-0.03055985-0.17209097j  0.95515993-1.41528469j]\n",
      "[-0.0309344-0.16142727j  0.940569 -1.4245342j ]\n",
      "[-0.03055985-0.17209097j  0.95515993-1.41528469j]\n",
      "[-0.03055985-0.17209097j  0.95515993-1.41528469j]\n",
      "[-0.03000227-0.1827339j   0.96955662-1.40575216j]\n",
      "[-0.03015837-0.18273445j  0.96965801-1.40591606j]\n",
      "[-0.03015823-0.18273022j  0.96965429-1.40591821j]\n",
      "[-0.03015816-0.18273023j  0.96965427-1.40591817j]\n",
      "[-0.03015816-0.18273023j  0.96965427-1.40591817j]\n",
      "[-0.03055985-0.17209097j  0.95515993-1.41528469j]\n",
      "[-0.03015816-0.18273023j  0.96965427-1.40591817j]\n",
      "[-0.03015816-0.18273023j  0.96965427-1.40591817j]\n",
      "[-0.0295735 -0.19334752j  0.98395159-1.39627108j]\n",
      "[-0.02972899-0.19334784j  0.98405363-1.39643396j]\n",
      "[-0.02972884-0.19334363j  0.98404993-1.39643612j]\n",
      "[-0.02972877-0.19334364j  0.98404991-1.39643607j]\n",
      "[-0.02972877-0.19334364j  0.98404991-1.39643607j]\n",
      "[-0.03015816-0.18273023j  0.96965427-1.40591817j]\n",
      "[-0.02972877-0.19334364j  0.98404991-1.39643607j]\n",
      "[-0.02972877-0.19334364j  0.98404991-1.39643607j]\n",
      "[-0.02911648-0.20393391j  0.99824577-1.38667595j]\n",
      "[-0.02927136-0.20393402j  0.99834843-1.38683776j]\n",
      "[-0.02927119-0.20392983j  0.99834476-1.38683993j]\n",
      "[-0.02927112-0.20392984j  0.99834474-1.38683988j]\n",
      "[-0.02927112-0.20392984j  0.99834474-1.38683988j]\n",
      "[-0.02972877-0.19334364j  0.98404991-1.39643607j]\n",
      "[-0.02927112-0.20392984j  0.99834474-1.38683988j]\n",
      "[-0.02927112-0.20392984j  0.99834474-1.38683988j]\n",
      "[-0.02863063-0.21449173j  1.01243704-1.37696825j]\n",
      "[-0.02878484-0.21449164j  1.01254032-1.37712898j]\n",
      "[-0.02878466-0.21448748j  1.01253667-1.37713114j]\n",
      "[-0.02878459-0.21448749j  1.01253665-1.3771311j ]\n",
      "[-0.02878459-0.21448749j  1.01253665-1.3771311j ]\n",
      "[-0.02927112-0.20392984j  0.99834474-1.38683988j]\n",
      "[-0.02878459-0.21448749j  1.01253665-1.3771311j ]\n",
      "[-0.02878459-0.21448749j  1.01253665-1.3771311j ]\n",
      "[-0.02811529-0.22501966j  1.02652329-1.36714953j]\n",
      "[-0.02826881-0.2250194j   1.02662715-1.36730912j]\n",
      "[-0.02826862-0.22501527j  1.02662354-1.36731129j]\n",
      "[-0.02826855-0.22501528j  1.02662352-1.36731125j]\n",
      "[-0.02826855-0.22501528j  1.02662352-1.36731125j]\n",
      "[-0.02878459-0.21448749j  1.01253665-1.3771311j ]\n",
      "[-0.02826855-0.22501528j  1.02662352-1.36731125j]\n",
      "[-0.02826855-0.22501528j  1.02662352-1.36731125j]\n",
      "[-0.0275698 -0.23551643j  1.04050237-1.35722132j]\n",
      "[-0.0277226 -0.23551602j  1.04060681-1.35737976j]\n",
      "[-0.0277224 -0.23551192j  1.04060322-1.35738193j]\n",
      "[-0.02772233-0.23551193j  1.0406032 -1.35738189j]\n",
      "[-0.02772233-0.23551193j  1.0406032 -1.35738189j]\n",
      "[-0.02826855-0.22501528j  1.02662352-1.36731125j]\n",
      "[-0.02772233-0.23551193j  1.0406032 -1.35738189j]\n",
      "[-0.02772233-0.23551193j  1.0406032 -1.35738189j]\n",
      "[-0.02699346-0.24598078j  1.05437215-1.34718522j]\n",
      "[-0.02714551-0.24598025j  1.05447714-1.34734245j]\n",
      "[-0.0271453 -0.24597618j  1.05447358-1.34734463j]\n",
      "[-0.02714523-0.24597619j  1.05447356-1.34734459j]\n",
      "[-0.02714523-0.24597619j  1.05447356-1.34734459j]\n",
      "[-0.02772233-0.23551193j  1.0406032 -1.35738189j]\n",
      "[-0.02714523-0.24597619j  1.05447356-1.34734459j]\n",
      "[-0.02714523-0.24597619j  1.05447356-1.34734459j]\n",
      "[-0.02638552-0.25641151j  1.06813047-1.33704282j]\n",
      "[-0.0265368 -0.25641088j  1.06823598-1.33719882j]\n",
      "[-0.02653658-0.25640684j  1.06823246-1.337201j  ]\n",
      "[-0.02653651-0.25640685j  1.06823244-1.33720096j]\n",
      "[-0.02653651-0.25640685j  1.06823244-1.33720096j]\n",
      "[-0.02714523-0.24597619j  1.05447356-1.34734459j]\n",
      "[-0.02653651-0.25640685j  1.06823244-1.33720096j]\n",
      "[-0.02653651-0.25640685j  1.06823244-1.33720096j]\n",
      "[-0.02574525-0.26680744j  1.08177515-1.32679574j]\n",
      "[-0.02589572-0.26680674j  1.08188118-1.32695048j]\n",
      "[-0.02589549-0.26680273j  1.08187769-1.32695266j]\n",
      "[-0.02589543-0.26680274j  1.08187768-1.32695262j]\n",
      "[-0.02589543-0.26680274j  1.08187768-1.32695262j]\n",
      "[-0.02653651-0.25640685j  1.06823244-1.33720096j]\n",
      "[-0.02589543-0.26680274j  1.08187768-1.32695262j]\n",
      "[-0.02589543-0.26680274j  1.08187768-1.32695262j]\n",
      "[-0.02507184-0.27716743j  1.09530402-1.31644565j]\n",
      "[-0.02522148-0.2771667j   1.09541055-1.31659908j]\n",
      "[-0.02522124-0.27716272j  1.09540709-1.31660126j]\n",
      "[-0.02522118-0.27716273j  1.09540707-1.31660122j]\n",
      "[-0.02522118-0.27716273j  1.09540707-1.31660122j]\n",
      "[-0.02589543-0.26680274j  1.08187768-1.32695262j]\n",
      "[-0.02522118-0.27716273j  1.09540707-1.31660122j]\n",
      "[-0.02522118-0.27716273j  1.09540707-1.31660122j]\n",
      "[-0.02436447-0.2874904j  1.10871488-1.3059942j]\n",
      "[-0.02451326-0.28748965j  1.10882187-1.30614628j]\n",
      "[-0.02451302-0.2874857j   1.10881846-1.30614847j]\n",
      "[-0.02451296-0.28748571j  1.10881844-1.30614843j]\n",
      "[-0.02451296-0.28748571j  1.10881844-1.30614843j]\n",
      "[-0.02522118-0.27716273j  1.09540707-1.31660122j]\n",
      "[-0.02451296-0.28748571j  1.10881844-1.30614843j]\n",
      "[-0.02451296-0.28748571j  1.10881844-1.30614843j]\n",
      "[-0.0236223-0.29777529j  1.1220055-1.29544308j]\n",
      "[-0.02377022-0.29777455j  1.12211295-1.29559378j]\n",
      "[-0.02376997-0.29777063j  1.12210957-1.29559597j]\n",
      "[-0.02376991-0.29777064j  1.12210955-1.29559593j]\n",
      "[-0.02376991-0.29777065j  1.12210955-1.29559593j]\n",
      "[-0.02451296-0.28748571j  1.10881844-1.30614843j]\n",
      "[-0.02376991-0.29777065j  1.12210955-1.29559593j]\n",
      "[-0.02376991-0.29777065j  1.12210955-1.29559593j]\n",
      "[-0.02284447-0.30802108j  1.13517366-1.28479401j]\n",
      "[-0.02299148-0.30802039j  1.13528153-1.28494329j]\n",
      "[-0.02299123-0.30801651j  1.13527819-1.28494548j]\n",
      "[-0.02299117-0.30801652j  1.13527817-1.28494544j]\n",
      "[-0.02299117-0.30801652j  1.13527817-1.28494544j]\n",
      "[-0.02376991-0.29777065j  1.12210955-1.29559593j]\n",
      "[-0.02299117-0.30801652j  1.13527817-1.28494544j]\n",
      "[-0.02299117-0.30801652j  1.13527817-1.28494544j]\n",
      "[-0.02203006-0.31822684j  1.14821707-1.2740487j ]\n",
      "[-0.02217615-0.31822622j  1.14832537-1.27419653j]\n",
      "[-0.0221759 -0.31822238j  1.14832206-1.27419872j]\n",
      "[-0.02217584-0.31822239j  1.14832204-1.27419868j]\n",
      "[-0.02217584-0.31822239j  1.14832204-1.27419868j]\n",
      "[-0.02299117-0.30801652j  1.13527817-1.28494544j]\n",
      "[-0.02217584-0.31822239j  1.14832204-1.27419868j]\n",
      "[-0.02217584-0.31822239j  1.14832204-1.27419868j]\n",
      "[-0.02117815-0.32839164j  1.16113348-1.26320891j]\n",
      "[-0.02132331-0.32839113j  1.16124216-1.26335525j]\n",
      "[-0.02132306-0.32838732j  1.1612389 -1.26335744j]\n",
      "[-0.02132299-0.32838733j  1.16123888-1.2633574j ]\n",
      "[-0.02132299-0.32838733j  1.16123888-1.2633574j ]\n",
      "[-0.02217584-0.31822239j  1.14832204-1.27419868j]\n",
      "[-0.02132299-0.32838733j  1.16123888-1.2633574j ]\n",
      "[-0.02132299-0.32838733j  1.16123888-1.2633574j ]\n",
      "[-0.02028779-0.33851463j  1.17392056-1.2522764j ]\n",
      "[-0.020432  -0.33851426j  1.17402962-1.2524212j ]\n",
      "[-0.02043175-0.33851049j  1.17402639-1.25242339j]\n",
      "[-0.02043169-0.3385105j   1.17402638-1.25242335j]\n",
      "[-0.02043169-0.3385105j   1.17402638-1.25242335j]\n",
      "[-0.02132299-0.32838733j  1.16123888-1.2633574j ]\n",
      "[-0.02043169-0.3385105j   1.17402638-1.25242335j]\n",
      "[-0.02043169-0.3385105j   1.17402638-1.25242335j]\n",
      "[-0.01935802-0.34859501j  1.18657598-1.24125292j]\n",
      "[-0.01950125-0.34859482j  1.18668539-1.24139615j]\n",
      "[-0.019501  -0.34859108j  1.18668221-1.24139834j]\n",
      "[-0.01950094-0.34859109j  1.18668219-1.2413983j ]\n",
      "[-0.01950094-0.34859109j  1.18668219-1.2413983j ]\n",
      "[-0.02043169-0.3385105j   1.17402638-1.25242335j]\n",
      "[-0.01950094-0.34859109j  1.18668219-1.2413983j ]\n",
      "[-0.01950094-0.34859109j  1.18668219-1.2413983j ]\n",
      "[-0.01838783-0.35863203j  1.19909737-1.23014027j]\n",
      "[-0.01853007-0.35863205j  1.19920713-1.23028189j]\n",
      "[-0.01852983-0.35862835j  1.19920399-1.23028408j]\n",
      "[-0.01852977-0.35862836j  1.19920397-1.23028404j]\n",
      "[-0.01852977-0.35862836j  1.19920397-1.23028404j]\n",
      "[-0.01950094-0.34859109j  1.18668219-1.2413983j ]\n",
      "[-0.01852977-0.35862836j  1.19920397-1.23028404j]\n",
      "[-0.01852977-0.35862836j  1.19920397-1.23028404j]\n",
      "[-0.01737621-0.36862502j  1.21148235-1.21894024j]\n",
      "[-0.01751745-0.36862528j  1.21159243-1.21908021j]\n",
      "[-0.01751721-0.36862162j  1.21158933-1.21908239j]\n",
      "[-0.01751715-0.36862163j  1.21158932-1.21908235j]\n",
      "[-0.01751715-0.36862163j  1.21158932-1.21908235j]\n",
      "[-0.01852977-0.35862836j  1.19920397-1.23028404j]\n",
      "[-0.01751715-0.36862163j  1.21158932-1.21908235j]\n",
      "[-0.01751715-0.36862163j  1.21158932-1.21908235j]\n",
      "[-0.01632213-0.37857334j  1.22372849-1.20765463j]\n",
      "[-0.01646235-0.37857388j  1.22383887-1.2077929j ]\n",
      "[-0.01646212-0.37857026j  1.22383582-1.20779508j]\n",
      "[-0.01646206-0.37857027j  1.2238358 -1.20779504j]\n",
      "[-0.01646206-0.37857027j  1.2238358 -1.20779504j]\n",
      "[-0.01751715-0.36862163j  1.21158932-1.21908235j]\n",
      "[-0.01646206-0.37857027j  1.2238358 -1.20779504j]\n",
      "[-0.01646206-0.37857027j  1.2238358 -1.20779504j]\n",
      "[-0.01522451-0.38847644j  1.23583332-1.19628523j]\n",
      "[-0.01536372-0.3884773j   1.23594399-1.19642177j]\n",
      "[-0.01536349-0.38847372j  1.23594098-1.19642394j]\n",
      "[-0.01536343-0.38847373j  1.23594097-1.19642391j]\n",
      "[-0.01536343-0.38847373j  1.23594097-1.19642391j]\n",
      "[-0.01646206-0.37857027j  1.2238358 -1.20779504j]\n",
      "[-0.01536343-0.38847373j  1.23594097-1.19642391j]\n",
      "[-0.01536343-0.38847373j  1.23594097-1.19642391j]\n",
      "[-0.01408231-0.39833383j  1.24779436-1.18483385j]\n",
      "[-0.01422048-0.39833504j  1.24790529-1.18496862j]\n",
      "[-0.01422026-0.3983315j   1.24790234-1.18497079j]\n",
      "[-0.01422021-0.39833151j  1.24790232-1.18497075j]\n",
      "[-0.01422021-0.39833151j  1.24790232-1.18497075j]\n",
      "[-0.01536343-0.38847373j  1.23594097-1.19642391j]\n",
      "[-0.01422021-0.39833151j  1.24790232-1.18497075j]\n",
      "[-0.01422021-0.39833151j  1.24790232-1.18497075j]\n",
      "[-0.01289442-0.40814509j  1.25960906-1.1733023j ]\n",
      "[-0.01303156-0.40814669j  1.25972025-1.17343525j]\n",
      "[-0.01303135-0.40814319j  1.25971734-1.17343742j]\n",
      "[-0.01303129-0.4081432j   1.25971732-1.17343738j]\n",
      "[-0.01303129-0.4081432j   1.25971732-1.17343738j]\n",
      "[-0.01422021-0.39833151j  1.24790232-1.18497075j]\n",
      "[-0.01303129-0.4081432j   1.25971732-1.17343738j]\n",
      "[-0.01303129-0.4081432j   1.25971732-1.17343738j]\n",
      "[-0.01165975-0.41790987j  1.27127486-1.16169238j]\n",
      "[-0.01179584-0.4179119j   1.27138628-1.16182347j]\n",
      "[-0.01179565-0.41790844j  1.27138342-1.16182563j]\n",
      "[-0.01179559-0.41790845j  1.27138341-1.1618256j ]\n",
      "[-0.01179559-0.41790845j  1.27138341-1.1618256j ]\n",
      "[-0.01303129-0.4081432j   1.25971732-1.17343738j]\n",
      "[-0.01179559-0.41790845j  1.27138341-1.1618256j ]\n",
      "[-0.01179559-0.41790845j  1.27138341-1.1618256j ]\n",
      "[-0.01037719-0.4276279j   1.28278913-1.15000587j]\n",
      "[-0.01051224-0.4276304j   1.28290078-1.15013506j]\n",
      "[-0.01051205-0.42762698j  1.28289798-1.15013721j]\n",
      "[-0.010512  -0.42762699j  1.28289796-1.15013718j]\n",
      "[-0.010512  -0.42762699j  1.28289796-1.15013718j]\n",
      "[-0.01179559-0.41790845j  1.27138341-1.1618256j ]\n",
      "[-0.010512  -0.42762699j  1.28289796-1.15013718j]\n",
      "[-0.010512  -0.42762699j  1.28289796-1.15013718j]\n",
      "[-0.00904562-0.437299j    1.29414924-1.13824456j]\n",
      "[-0.00917962-0.43730201j  1.2942611 -1.1383718j ]\n",
      "[-0.00917945-0.43729862j  1.29425834-1.13837395j]\n",
      "[-0.00917939-0.43729863j  1.29425833-1.13837391j]\n",
      "[-0.00917939-0.43729863j  1.29425833-1.13837391j]\n",
      "[-0.010512  -0.42762699j  1.28289796-1.15013718j]\n",
      "[-0.00917939-0.43729863j  1.29425833-1.13837391j]\n",
      "[-0.00917939-0.43729863j  1.29425833-1.13837391j]\n",
      "[-0.00766392-0.44692305j  1.30535247-1.1264102j ]\n",
      "[-0.00779686-0.4469266j   1.30546453-1.12653545j]\n",
      "[-0.00779671-0.44692325j  1.30546183-1.12653759j]\n",
      "[-0.00779665-0.44692326j  1.30546181-1.12653756j]\n",
      "[-0.00779665-0.44692326j  1.30546181-1.12653756j]\n",
      "[-0.00917939-0.43729863j  1.29425833-1.13837391j]\n",
      "[-0.00779665-0.44692326j  1.30546181-1.12653756j]\n",
      "[-0.00779665-0.44692326j  1.30546181-1.12653756j]\n",
      "[-0.00623094-0.45650002j  1.31639609-1.11450455j]\n",
      "[-0.00636285-0.45650415j  1.31650833-1.11462776j]\n",
      "[-0.0063627 -0.45650085j  1.31650568-1.1146299j ]\n",
      "[-0.00636265-0.45650085j  1.31650566-1.11462987j]\n",
      "[-0.00636265-0.45650085j  1.31650566-1.11462987j]\n",
      "[-0.00779665-0.44692326j  1.30546181-1.12653756j]\n",
      "[-0.00636265-0.45650085j  1.31650566-1.11462987j]\n",
      "[-0.00636265-0.45650085j  1.31650566-1.11462987j]\n",
      "[-0.00474557-0.46602999j  1.3272773 -1.10252932j]\n",
      "[-0.00487643-0.46603474j  1.32738971-1.10265045j]\n",
      "[-0.00487631-0.46603147j  1.32738711-1.10265259j]\n",
      "[-0.00487626-0.46603148j  1.3273871 -1.10265256j]\n",
      "[-0.00487626-0.46603148j  1.3273871 -1.10265256j]\n",
      "[-0.00636265-0.45650085j  1.31650566-1.11462987j]\n",
      "[-0.00487626-0.46603148j  1.3273871 -1.10265256j]\n",
      "[-0.00487626-0.46603148j  1.3273871 -1.10265256j]\n",
      "[-0.00320668-0.4755131j   1.33799326-1.09048621j]\n",
      "[-0.00333651-0.47551851j  1.33810583-1.09060521j]\n",
      "[-0.0033364 -0.47551528j  1.33810329-1.09060734j]\n",
      "[-0.00333635-0.47551529j  1.33810327-1.09060731j]\n",
      "[-0.00333635-0.47551529j  1.33810327-1.09060731j]\n",
      "[-0.00487626-0.46603148j  1.3273871 -1.10265256j]\n",
      "[-0.00333635-0.47551529j  1.33810327-1.09060731j]\n",
      "[-0.00333635-0.47551529j  1.33810327-1.09060731j]\n",
      "[-0.00161314-0.4849496j   1.34854109-1.07837686j]\n",
      "[-0.00174194-0.48495571j  1.34865381-1.0784937j ]\n",
      "[-0.00174186-0.48495252j  1.34865133-1.07849582j]\n",
      "[-0.00174181-0.48495253j  1.34865131-1.07849579j]\n",
      "[-0.00174181-0.48495253j  1.34865131-1.07849579j]\n",
      "[-0.00333635-0.47551529j  1.33810327-1.09060731j]\n",
      "[-0.00174181-0.48495253j  1.34865131-1.07849579j]\n",
      "[-0.00174181-0.48495253j  1.34865131-1.07849579j]\n",
      "[3.61482736e-05-0.49433984j 1.35891785e+00-1.06620291j]\n",
      "[-9.16318121e-05-0.49434669j  1.35903072e+00-1.06631753j]\n",
      "[-9.15671786e-05-0.49434354j  1.35902830e+00-1.06631965j]\n",
      "[-9.15193055e-05-0.49434354j  1.35902828e+00-1.06631962j]\n",
      "[-9.15193622e-05-0.49434354j  1.35902828e+00-1.06631962j]\n",
      "[-0.00174181-0.48495253j  1.34865131-1.07849579j]\n",
      "[-9.15193622e-05-0.49434354j  1.35902828e+00-1.06631962j]\n",
      "[-9.15193622e-05-0.49434354j  1.35902828e+00-1.06631962j]\n",
      "[0.0017423 -0.50368426j 1.36912057-1.05396592j]\n",
      "[0.00161552-0.5036919j  1.36923357-1.05407828j]\n",
      "[0.00161556-0.50368878j 1.3692312 -1.05408039j]\n",
      "[0.00161561-0.50368878j 1.36923119-1.05408036j]\n",
      "[0.00161561-0.50368878j 1.36923119-1.05408036j]\n",
      "[-9.15193622e-05-0.49434354j  1.35902828e+00-1.06631962j]\n",
      "[0.00161561-0.50368878j 1.36923119-1.05408036j]\n",
      "[0.00161561-0.50368878j 1.36923119-1.05408036j]\n",
      "[0.00350638-0.51298342j 1.37914621-1.04166741j]\n",
      "[0.0033806 -0.51299187j 1.37925934-1.04177746j]\n",
      "[0.00338061-0.51298879j 1.37925703-1.04177957j]\n",
      "[0.00338066-0.5129888j  1.37925701-1.04177954j]\n",
      "[0.00338066-0.5129888j  1.37925701-1.04177954j]\n",
      "[0.00161561-0.50368878j 1.36923119-1.05408036j]\n",
      "[0.00338066-0.5129888j  1.37925701-1.04177954j]\n",
      "[0.00338066-0.5129888j  1.37925701-1.04177954j]\n",
      "[0.00532945-0.52223797j 1.38899168-1.02930885j]\n",
      "[0.00520465-0.52224728j 1.38910493-1.02941655j]\n",
      "[0.00520464-0.52224423j 1.38910268-1.02941865j]\n",
      "[0.00520468-0.52224424j 1.38910267-1.02941862j]\n",
      "[0.00520468-0.52224424j 1.38910267-1.02941862j]\n",
      "[0.00338066-0.5129888j  1.37925701-1.04177954j]\n",
      "[0.00520468-0.52224424j 1.38910267-1.02941862j]\n",
      "[0.00520468-0.52224424j 1.38910267-1.02941862j]\n",
      "[0.00721255-0.53144867j 1.39865386-1.01689164j]\n",
      "[0.0070887 -0.53145888j 1.39876724-1.01699694j]\n",
      "[0.00708867-0.53145586j 1.39876505-1.01699903j]\n",
      "[0.00708871-0.53145587j 1.39876503-1.016999j  ]\n",
      "[0.00708871-0.53145587j 1.39876503-1.016999j  ]\n",
      "[0.00520468-0.52224424j 1.38910267-1.02941862j]\n",
      "[0.00708871-0.53145587j 1.39876503-1.016999j  ]\n",
      "[0.00708871-0.53145587j 1.39876503-1.016999j  ]\n",
      "[0.00915666-0.54061641j 1.40812958-1.0044171j ]\n",
      "[0.00903375-0.54062755j 1.40824307-1.00451995j]\n",
      "[0.00903369-0.54062457j 1.40824094-1.00452204j]\n",
      "[0.00903374-0.54062457j 1.40824093-1.00452201j]\n",
      "[0.00903374-0.54062457j 1.40824093-1.00452201j]\n",
      "[0.00708871-0.53145587j 1.39876503-1.016999j  ]\n",
      "[0.00903374-0.54062457j 1.40824093-1.00452201j]\n",
      "[0.00903374-0.54062457j 1.40824093-1.00452201j]\n",
      "[0.01116275-0.54974216j 1.41741562-0.99188649j]\n",
      "[0.01104076-0.54975428j 1.41752923-0.99198685j]\n",
      "[0.01104067-0.54975133j 1.41752716-0.99198893j]\n",
      "[0.01104072-0.54975133j 1.41752714-0.9919889j ]\n",
      "[0.01104072-0.54975133j 1.41752714-0.9919889j ]\n",
      "[0.00903374-0.54062457j 1.40824093-1.00452201j]\n",
      "[0.01104072-0.54975133j 1.41752714-0.9919889j ]\n",
      "[0.01104072-0.54975133j 1.41752714-0.9919889j ]\n",
      "[0.01323173-0.55882705j 1.42650871-0.97930097j]\n",
      "[0.01311064-0.55884018j 1.42662244-0.97939879j]\n",
      "[0.01311052-0.55883726j 1.42662043-0.97940086j]\n",
      "[0.01311056-0.55883727j 1.42662041-0.97940084j]\n",
      "[0.01311056-0.55883727j 1.42662041-0.97940084j]\n",
      "[0.01104072-0.54975133j 1.41752714-0.9919889j ]\n",
      "[0.01311056-0.55883727j 1.42662041-0.97940084j]\n",
      "[0.01311056-0.55883727j 1.42662041-0.97940084j]\n",
      "[0.01536447-0.5678723j  1.43540556-0.96666161j]\n",
      "[0.01524424-0.56788648j 1.4355194 -0.96675684j]\n",
      "[0.01524409-0.5678836j  1.43551746-0.96675891j]\n",
      "[0.01524413-0.5678836j  1.43551744-0.96675889j]\n",
      "[0.01524413-0.5678836j  1.43551744-0.96675889j]\n",
      "[0.01311056-0.55883727j 1.42662041-0.97940084j]\n",
      "[0.01524413-0.5678836j  1.43551744-0.96675889j]\n",
      "[0.01524413-0.5678836j  1.43551744-0.96675889j]\n",
      "[0.01756176-0.57687927j 1.44410283-0.95396938j]\n",
      "[0.01744237-0.57689453j 1.44421679-0.95406198j]\n",
      "[0.01744219-0.57689168j 1.44421491-0.95406404j]\n",
      "[0.01744223-0.57689168j 1.4442149 -0.95406402j]\n",
      "[0.01744223-0.57689168j 1.4442149 -0.95406402j]\n",
      "[0.01524413-0.5678836j  1.43551744-0.96675889j]\n",
      "[0.01744223-0.57689168j 1.4442149 -0.95406402j]\n",
      "[0.01744223-0.57689168j 1.4442149 -0.95406402j]\n",
      "[0.01982435-0.58584942j 1.45259715-0.94122514j]\n",
      "[0.01970576-0.5858658j  1.45271124-0.94131506j]\n",
      "[0.01970555-0.58586298j 1.45270942-0.94131712j]\n",
      "[0.01970559-0.58586298j 1.45270941-0.9413171j ]\n",
      "[0.01970559-0.58586298j 1.45270941-0.9413171j ]\n",
      "[0.01744223-0.57689168j 1.4442149 -0.95406402j]\n",
      "[0.01970559-0.58586298j 1.45270941-0.9413171j ]\n",
      "[0.01970559-0.58586298j 1.45270941-0.9413171j ]\n",
      "[0.02215289-0.59478436j 1.46088513-0.92842963j]\n",
      "[0.02203508-0.5948019j  1.46099935-0.92851683j]\n",
      "[0.02203484-0.59479911j 1.4609976 -0.92851888j]\n",
      "[0.02203488-0.59479911j 1.46099758-0.92851886j]\n",
      "[0.02203488-0.59479911j 1.46099758-0.92851886j]\n",
      "[0.01970559-0.58586298j 1.45270941-0.9413171j ]\n",
      "[0.02203488-0.59479911j 1.46099758-0.92851886j]\n",
      "[0.02203488-0.59479911j 1.46099758-0.92851886j]\n",
      "[0.02454797-0.60368581j 1.46896336-0.91558347j]\n",
      "[0.0244309 -0.60370455j 1.46907772-0.91566791j]\n",
      "[0.02443062-0.60370179j 1.46907603-0.91566995j]\n",
      "[0.02443066-0.60370179j 1.46907601-0.91566993j]\n",
      "[0.02443066-0.60370179j 1.46907601-0.91566993j]\n",
      "[0.02203488-0.59479911j 1.46099758-0.92851886j]\n",
      "[0.02443066-0.60370179j 1.46907601-0.91566993j]\n",
      "[0.02443066-0.60370179j 1.46907601-0.91566993j]\n",
      "[0.02701008-0.61255563j 1.47682841-0.90268714j]\n",
      "[0.02689372-0.61257561j 1.47694291-0.90276876j]\n",
      "[0.0268934 -0.61257287j 1.47694129-0.90277081j]\n",
      "[0.02689344-0.61257287j 1.47694127-0.90277079j]\n",
      "[0.02689344-0.61257287j 1.47694127-0.90277079j]\n",
      "[0.02443066-0.60370179j 1.46907601-0.91566993j]\n",
      "[0.02689344-0.61257287j 1.47694127-0.90277079j]\n",
      "[0.02689344-0.61257287j 1.47694127-0.90277079j]\n",
      "[0.02953961-0.62139581j 1.48447684-0.88974098j]\n",
      "[0.02942391-0.62141705j 1.4845915 -0.88981975j]\n",
      "[0.02942356-0.62141433j 1.48458994-0.88982179j]\n",
      "[0.0294236 -0.62141433j 1.48458993-0.88982177j]\n",
      "[0.0294236 -0.62141433j 1.48458993-0.88982177j]\n",
      "[0.02689344-0.61257287j 1.47694127-0.90277079j]\n",
      "[0.0294236 -0.62141433j 1.48458993-0.88982177j]\n",
      "[0.0294236 -0.62141433j 1.48458993-0.88982177j]\n",
      "[0.0294236 -0.62141433j 1.48458993-0.88982177j]\n",
      "[0.0294236 -0.62141433j 1.48458993-0.88982177j]\n",
      "[-0.09288486-0.41620126j -0.34124102+1.76397962j]\n",
      "[-0.09288486-0.41620126j -0.34124102+1.76397962j]\n",
      "[-0.09288486-0.41620126j -0.34124102+1.76397962j]\n",
      "[-0.09288486-0.41620126j -0.34124102+1.76397962j]\n",
      "[ 0.16996549+1.30010002j -1.1433489 -0.87415784j]\n",
      "[ 0.16996549+1.30010002j -1.1433489 -0.87415784j]\n",
      "[ 0.16996549+1.30010002j -1.1433489 -0.87415784j]\n",
      "[ 0.16996549+1.30010002j -1.1433489 -0.87415784j]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Distances: [3.2357770689842407]\n",
      "Warning:GBZConditionChecker2D.get_full_solution: continuation check failed\n"
     ]
    }
   ],
   "source": [
    "check_result =csolver.check_GBZ_condition(char_poly, non_GBZ_points[0][:3], non_GBZ_params[0], 2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [],
   "source": [
    "winding_solver = csolver.GBZConditionChecker2D(non_GBZ_points[0][:3], non_GBZ_params[0][0], char_poly, 2, 0.1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [],
   "source": [
    "beta0 = non_GBZ_points[0][2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "5.052090021422052\n"
     ]
    }
   ],
   "source": [
    "print(abs(beta0))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1,-1\n",
      "1,-1\n",
      "1,-1\n",
      "1,-1\n",
      "1,-1\n",
      "1,-1\n",
      "1,-1\n",
      "1,-1\n",
      "1,-1\n",
      "1,-1\n",
      "1,-1\n",
      "1,-1\n",
      "1,-1\n",
      "1,-1\n",
      "1,-1\n",
      "1,-1\n",
      "1,-1\n",
      "1,-1\n",
      "1,-1\n",
      "1,-1\n",
      "1,-1\n",
      "1,-1\n",
      "1,-1\n",
      "1,-1\n",
      "1,-1\n",
      "1,-1\n",
      "1,-2\n",
      "1,-2\n",
      "1,-2\n",
      "1,-2\n",
      "1,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Distances: [3.2515546367139727]\n",
      "Warning:GBZConditionChecker2D.get_full_solution: continuation check failed\n"
     ]
    }
   ],
   "source": [
    "winding_solver.eval_param_path(beta0*np.exp(1j * np.linspace(0, 2 * np.pi, 100)), non_GBZ_points[0][[0,1]], \n",
    "                    N_points_loop = 200, N_points_detour = 50, theta_detour=5e-3*np.pi, zero_eps = 1e-3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [],
   "source": [
    "def ymajor_aGBZ_sol(phi1, beta2):\n",
    "    expiphi1 = np.exp(-1j*phi1)\n",
    "    eq_poly = np.array([1 + 1/beta2, 0, - expiphi1, - beta2 * expiphi1*(1 + expiphi1)])\n",
    "    return np.roots(eq_poly)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [],
   "source": [
    "def ymajor_GBZ_check(beta1, beta2):\n",
    "    GBZ_conditions = (abs(beta2)/(beta1**2 * ( 1 + 1/beta2))) < abs(beta1)\n",
    "    if(not GBZ_conditions):\n",
    "        E = get_E(beta1, beta2)\n",
    "        beta1_eq = [1 + 1/beta2, -E, 1, beta2]\n",
    "        print(np.abs(np.roots(beta1_eq)))\n",
    "    return GBZ_conditions"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [],
   "source": [
    "def get_E(beta1, beta2):\n",
    "    return beta1 + 1/beta1 + beta1/beta2 + beta2/(beta1**2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [],
   "source": [
    "expiphi1 = non_GBZ_params[0][0]\n",
    "phi1 = np.log(expiphi1).imag % (2 * np.pi)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2.2791946702514188\n"
     ]
    }
   ],
   "source": [
    "print(phi1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'ymajor_aGBZ_sol' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Cell \u001b[0;32mIn[29], line 4\u001b[0m\n\u001b[1;32m      2\u001b[0m all_sols \u001b[39m=\u001b[39m np\u001b[39m.\u001b[39mzeros((\u001b[39mlen\u001b[39m(beta2_list), \u001b[39m3\u001b[39m), dtype\u001b[39m=\u001b[39m\u001b[39mcomplex\u001b[39m)\n\u001b[1;32m      3\u001b[0m \u001b[39mfor\u001b[39;00m j \u001b[39min\u001b[39;00m \u001b[39mrange\u001b[39m(\u001b[39mlen\u001b[39m(beta2_list)):\n\u001b[0;32m----> 4\u001b[0m     all_sols[j, :] \u001b[39m=\u001b[39m ymajor_aGBZ_sol(phi1, beta2_list[j])\n",
      "\u001b[0;31mNameError\u001b[0m: name 'ymajor_aGBZ_sol' is not defined"
     ]
    }
   ],
   "source": [
    "beta2_list = beta0 * np.exp(1j * np.linspace(0, 2 * np.pi, 100))\n",
    "all_sols = np.zeros((len(beta2_list), 3), dtype=complex)\n",
    "for j in range(len(beta2_list)):\n",
    "    all_sols[j, :] = ymajor_aGBZ_sol(phi1, beta2_list[j])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2.2791946702514188"
      ]
     },
     "execution_count": 49,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "phi1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[2.0473 1.4353 1.4353]\n",
      "[2.0661 1.4291 1.4291]\n",
      "[2.0852 1.4234 1.4234]\n",
      "[2.1045 1.418  1.418 ]\n",
      "[2.124 1.413 1.413]\n",
      "[2.1438 1.4084 1.4084]\n",
      "[2.1637 1.4043 1.4043]\n",
      "[2.1838 1.4005 1.4005]\n",
      "[2.204  1.3971 1.3971]\n",
      "[2.2243 1.3942 1.3942]\n",
      "[2.2446 1.3916 1.3916]\n",
      "[2.265  1.3895 1.3895]\n",
      "[2.2854 1.3878 1.3878]\n",
      "[2.3057 1.3866 1.3866]\n",
      "[2.3259 1.3858 1.3858]\n",
      "[2.3459 1.3854 1.3854]\n",
      "[2.3657 1.3855 1.3855]\n",
      "[2.3853 1.386  1.386 ]\n",
      "[2.4046 1.387  1.387 ]\n",
      "[2.4234 1.3885 1.3885]\n",
      "[2.4419 1.3904 1.3904]\n",
      "[2.4597 1.3929 1.3929]\n",
      "[2.477  1.3958 1.3958]\n",
      "[2.4936 1.3991 1.3991]\n",
      "[2.5094 1.403  1.403 ]\n",
      "[2.5243 1.4074 1.4074]\n",
      "[2.5383 1.4123 1.4123]\n",
      "[2.5511 1.4176 1.4176]\n",
      "[2.5628 1.4235 1.4235]\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "1,-2\n",
      "0,-2\n",
      "1,-1\n",
      "1,-2\n",
      "0,-2\n",
      "1,-1\n",
      "1,-2\n",
      "0,-2\n",
      "1,-1\n",
      "1,-2\n",
      "0,-2\n",
      "1,-2\n",
      "1,-2\n",
      "0,-2\n",
      "1,-1\n",
      "1,-2\n",
      "0,-2\n",
      "1,-1\n",
      "1,-2\n",
      "0,-2\n",
      "1,-1\n",
      "1,-2\n",
      "0,-2\n",
      "1,-1\n",
      "1,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "[1.6788 2.2011 1.6788]\n",
      "[1.6705 2.2349 1.6705]\n",
      "[1.6617 2.2684 1.6617]\n",
      "[2.3014 1.6523 1.6523]\n",
      "[2.3335 1.6424 1.6424]\n",
      "[2.3647 1.6321 1.6321]\n",
      "[2.3946 1.6214 1.6214]\n",
      "[2.4231 1.6104 1.6104]\n",
      "[2.4499 1.5991 1.5991]\n",
      "[2.4749 1.5877 1.5877]\n",
      "[2.4978 1.5761 1.5761]\n",
      "[2.5186 1.5646 1.5646]\n",
      "[2.5372 1.5531 1.5531]\n",
      "[2.5534 1.5417 1.5417]\n",
      "[2.5672 1.5305 1.5305]\n",
      "[2.5787 1.5195 1.5195]\n",
      "[2.5877 1.5088 1.5088]\n",
      "[2.5944 1.4984 1.4984]\n",
      "[2.5989 1.4883 1.4883]\n",
      "[2.6011 1.4787 1.4787]\n",
      "[2.6012 1.4694 1.4694]\n",
      "[2.5992 1.4607 1.4607]\n",
      "[2.5954 1.4523 1.4523]\n",
      "[2.5898 1.4445 1.4445]\n",
      "[2.5825 1.4371 1.4371]\n",
      "[2.5736 1.4302 1.4302]\n",
      "[2.5633 1.4238 1.4238]\n",
      "[2.5517 1.4179 1.4179]\n",
      "[2.5389 1.4125 1.4125]\n",
      "[2.525  1.4076 1.4076]\n",
      "[2.5101 1.4032 1.4032]\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "1,-2\n",
      "0,-2\n",
      "1,-1\n",
      "1,-2\n",
      "0,-2\n",
      "1,-1\n",
      "1,-2\n",
      "0,-2\n",
      "1,-1\n",
      "1,-2\n",
      "0,-2\n",
      "1,-2\n",
      "1,-2\n",
      "0,-2\n",
      "1,-1\n",
      "1,-2\n",
      "0,-2\n",
      "1,-1\n",
      "1,-2\n",
      "0,-2\n",
      "1,-1\n",
      "1,-2\n",
      "0,-2\n",
      "1,-1\n",
      "1,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "[1.4889 1.925  1.4889]\n",
      "[1.4801 1.9414 1.4801]\n",
      "[1.4717 1.9581 1.4717]\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "[1.9753 1.4637 1.4637]\n",
      "[1.9928 1.456  1.456 ]\n",
      "[2.0107 1.4487 1.4487]\n",
      "[2.0288 1.4418 1.4418]\n",
      "[2.0473 1.4353 1.4353]\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n",
      "1,-1\n",
      "0,-2\n",
      "0,-2\n"
     ]
    }
   ],
   "source": [
    "GBZ_conditions = np.zeros_like(all_sols, dtype=bool)\n",
    "conditions_winding_solver = np.zeros_like(all_sols, dtype=bool)\n",
    "for j in range(len(beta2_list)):\n",
    "    for k in range(3):\n",
    "        beta1 = all_sols[j,k]\n",
    "        beta2 = beta2_list[j]\n",
    "        GBZ_conditions[j,k] = ymajor_GBZ_check(all_sols[j,k], beta2_list[j])\n",
    "        # print(char_poly.eval(csolver.CScalarVec([get_E(beta1, beta2), beta1*np.exp(1j*phi1), beta2])))\n",
    "        conditions_winding_solver[j,k] = winding_solver.GBZ_condition_1d([get_E(beta1, beta2), beta1], beta2, theta_detour=0.1*np.pi)\n",
    "    #     beta1_list = beta1 * np.exp(1j*np.linspace(0, 2*np.pi, 200))\n",
    "    #     val_list = np.zeros_like(beta1_list, dtype=complex)\n",
    "    #     for u, curr_beta1 in enumerate(beta1_list):\n",
    "    #         val_list[u] = char_poly.eval(csolver.CScalarVec([get_E(beta1, beta2), curr_beta1, beta2]))\n",
    "    #     plt.plot(val_list.real, val_list.imag)\n",
    "    #     break\n",
    "    # break\n",
    "        # input()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Text(0, 0.5, '$\\\\beta_1$, imag')"
      ]
     },
     "execution_count": 53,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "plt.figure()\n",
    "for k in range(len(beta2_list)):\n",
    "    for j in range(3):\n",
    "        if(GBZ_conditions[k,j]):\n",
    "            plt.plot(all_sols[k,j].real, all_sols[k,j].imag, 'b.')\n",
    "        else:\n",
    "            plt.plot(all_sols[k,j].real, all_sols[k,j].imag, 'r.')\n",
    "plt.xlabel(\"$\\\\beta_1$, real\")\n",
    "plt.ylabel(\"$\\\\beta_1$, imag\")\n",
    "    # plt.pause(1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {},
   "outputs": [],
   "source": [
    "fig = plt.figure()\n",
    "ax = fig.add_subplot(projection='3d')\n",
    "for k in range(len(beta2_list)):\n",
    "    for j in range(3):\n",
    "        if(GBZ_conditions[k, j]):\n",
    "            plt.plot(all_sols[k, j].real, all_sols[k, j].imag, k, '.')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [],
   "source": [
    "new_solver = csolver.DirectGBZConditionChecker(char_poly, 2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([-0.0336-0.0104j,  0.7273-1.541j ,  5.0498+0.1528j, -0.8172+1.8003j])"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "GBZ_points[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2\n",
      "2\n",
      "2\n",
      "2\n",
      "2\n",
      "2\n",
      "2\n",
      "2\n",
      "2\n",
      "2\n",
      "2\n",
      "2\n",
      "2\n",
      "2\n",
      "2\n",
      "2\n",
      "0\n"
     ]
    },
    {
     "ename": "IndexError",
     "evalue": "too many indices for array: array is 1-dimensional, but 2 were indexed",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mIndexError\u001b[0m                                Traceback (most recent call last)",
      "Cell \u001b[0;32mIn[37], line 8\u001b[0m\n\u001b[1;32m      4\u001b[0m all_sols \u001b[39m=\u001b[39m new_solver\u001b[39m.\u001b[39mget_aGBZ_solutions(non_GBZ_points[curr_j][:\u001b[39m3\u001b[39m], \n\u001b[1;32m      5\u001b[0m             \u001b[39m# non_GBZ_params[0], \u001b[39;00m\n\u001b[1;32m      6\u001b[0m             [np\u001b[39m.\u001b[39mexp(\u001b[39m1\u001b[39mj \u001b[39m*\u001b[39m phi), \u001b[39m1\u001b[39m])\n\u001b[1;32m      7\u001b[0m \u001b[39mprint\u001b[39m(\u001b[39mlen\u001b[39m(all_sols))\n\u001b[0;32m----> 8\u001b[0m plt\u001b[39m.\u001b[39mplot(all_sols[:,\u001b[39m1\u001b[39;49m]\u001b[39m.\u001b[39mreal, all_sols[:,\u001b[39m1\u001b[39m]\u001b[39m.\u001b[39mimag, \u001b[39m'\u001b[39m\u001b[39m.\u001b[39m\u001b[39m'\u001b[39m)\n\u001b[1;32m      9\u001b[0m \u001b[39m# for j in range(all_sols.shape[0]):\u001b[39;00m\n\u001b[1;32m     10\u001b[0m \u001b[39m#     plt.plot(all_sols[j,0].real, all_sols[j,0].imag,'.')\u001b[39;00m\n\u001b[1;32m     11\u001b[0m \u001b[39m#     plt.plot(all_sols[j,0].real, all_sols[j,0].imag,'.')\u001b[39;00m\n",
      "\u001b[0;31mIndexError\u001b[0m: too many indices for array: array is 1-dimensional, but 2 were indexed"
     ]
    }
   ],
   "source": [
    "# for j in range(len(non_GBZ_points)):\n",
    "curr_j = 0\n",
    "for phi in np.linspace(np.pi/101, np.pi * 100/101, 100):\n",
    "    all_sols = new_solver.get_aGBZ_solutions(non_GBZ_points[curr_j][:3], \n",
    "                # non_GBZ_params[0], \n",
    "                [np.exp(1j * phi), 1])\n",
    "    print(len(all_sols))\n",
    "    plt.plot(all_sols[:,1].real, all_sols[:,1].imag, '.')\n",
    "    # for j in range(all_sols.shape[0]):\n",
    "    #     plt.plot(all_sols[j,0].real, all_sols[j,0].imag,'.')\n",
    "    #     plt.plot(all_sols[j,0].real, all_sols[j,0].imag,'.')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "aGBZ_2D_solver_IndexVec[0, 2, 1]\n"
     ]
    }
   ],
   "source": [
    "print(char_poly.denom_orders)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "two_eq = [\n",
    "    new_solver.eff_poly.to_str(csolver.CStrVec(['x','y'])),\n",
    "    new_solver.another_poly.to_str(csolver.CStrVec(['x', 'y']))\n",
    "]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['+(-1+0*i)*(y**2)+(-1+0*i)*x*y+(-0.0335552218447942724-0.0103963159238985841*i)*(x**2)*y+(-1+0*i)*(x**3)+(-1+0*i)*(x**3)*y;', '+(-1+0*i)*(y**2)+(0.65061830020424205-0.759404916654706885*i)*x*y+(-0.00512618942425076014+0.0347528197392609484*i)*(x**2)*y+(-0.850217135729613993-0.526432162877355614*i)*(x**3)+(-0.850217135729613993-0.526432162877355614*i)*(x**3)*y;']\n"
     ]
    }
   ],
   "source": [
    "print(two_eq)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "total degree : 16\n",
      "2-homogeneous Bezout number : 12\n",
      "  with with partition : { y }{ x }\n",
      "general linear-product Bezout number : 11\n",
      "  based on the set structure :\n",
      "     { y }{ y x }{ x }{ x }\n",
      "     { y }{ y x }{ x }{ x }\n",
      "mixed volume : 4\n",
      "stable mixed volume : 9\n"
     ]
    }
   ],
   "source": [
    "all_sols_phcpy = csolver.phcpy_solver.solve(two_eq, dictionary_output=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[ 0.7273 -1.541j   5.0498 +0.1528j]\n",
      " [-0.8172 +1.8003j -5.0496 +0.1583j]\n",
      " [-2.9475+23.2609j -1.0015 -0.0011j]]\n"
     ]
    }
   ],
   "source": [
    "print(all_sols)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# for j in range(4):\n",
    "#     new_solver.checker_1d.GBZ_condition_check(GBZ_points[0][0], all_sols[j,new_solver.which_var],\n",
    "#                                         all_sols[self.other_var], theta_detour, N_points_loop, N_points_detour, zero_eps)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'all_sols_phcpy' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Cell \u001b[0;32mIn[16], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[39mfor\u001b[39;00m sol \u001b[39min\u001b[39;00m all_sols_phcpy:\n\u001b[1;32m      2\u001b[0m     \u001b[39mprint\u001b[39m(sol[\u001b[39m'\u001b[39m\u001b[39mx\u001b[39m\u001b[39m'\u001b[39m], sol[\u001b[39m'\u001b[39m\u001b[39my\u001b[39m\u001b[39m'\u001b[39m])\n",
      "\u001b[0;31mNameError\u001b[0m: name 'all_sols_phcpy' is not defined"
     ]
    }
   ],
   "source": [
    "for sol in all_sols_phcpy:\n",
    "    print(sol['x'], sol['y'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[ 0.     +0.j      0.     +0.j    ]\n",
      " [-0.8172 +1.8003j -5.0496 +0.1583j]\n",
      " [ 0.7273 -1.541j   5.0498 +0.1528j]\n",
      " [-2.9475+23.2609j -1.0015 -0.0011j]]\n"
     ]
    }
   ],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[-0.0336-0.0104j  0.7273-1.541j   5.0498+0.1528j -0.8172+1.8003j]\n"
     ]
    }
   ],
   "source": [
    "print(GBZ_points[0])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# OBC spectrum"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "data_100x100 = sio.loadmat(\"data/minimal_model_OBC_spectrum_Nx_100_Ny_100.mat\")\n",
    "data_50x200 = sio.loadmat(\"data/minimal_model_OBC_spectrum_Nx_50_Ny_200.mat\")\n",
    "data_200x50 = sio.loadmat(\"data/minimal_model_OBC_spectrum_Nx_200_Ny_50.mat\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Text(0.5, 1.0, '200 x 50')"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fig = plt.figure()\n",
    "ax = fig.gca()\n",
    "ax.plot(data_100x100['eigv'].real, data_100x100['eigv'].imag, '.')\n",
    "ax.set_title(\"100 x 100\")\n",
    "\n",
    "fig = plt.figure()\n",
    "ax = fig.gca()\n",
    "ax.plot(data_50x200['eigv'].real, data_50x200['eigv'].imag, '.')\n",
    "ax.set_title(\"50 x 200\")\n",
    "fig = plt.figure()\n",
    "ax = fig.gca()\n",
    "ax.plot(data_200x50['eigv'].real, data_200x50['eigv'].imag, '.')\n",
    "ax.set_title(\"200 x 50\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "+(-1+0*i)*(z**2)+(-1+0*i)*y*z+(-1+0*i)*(y**3)+(-1+0*i)*(y**3)*z+(1+0*i)*x*(y**2)*z;\n"
     ]
    }
   ],
   "source": [
    "print(char_poly.num.to_str(csolver.CStrVec([\"x\", \"y\", \"z\"])))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[-0.0336-0.0104j  0.7273-1.541j   5.0498+0.1528j -0.8172+1.8003j]\n"
     ]
    }
   ],
   "source": [
    "curr_point = non_GBZ_points[0]\n",
    "print(curr_point)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[-0.0336-0.0104j  0.7273-1.541j   5.0498+0.1528j -0.8172+1.8003j]\n",
      "+(-1+0*i)*(y**2)+(-1+0*i)*x*y+(-0.0335552218447942724-0.0103963159238985841*i)*(x**2)*y+(-1+0*i)*(x**3)+(-1+0*i)*(x**3)*y;\n"
     ]
    }
   ],
   "source": [
    "eq1 = csolver.CPolyLinkedList(2)\n",
    "char_poly.num.partial_eval(csolver.CScalarVec([curr_point[0]]), csolver.CIndexVec([0]), csolver.CIndexVec([1, 2]), eq1)\n",
    "print(curr_point)\n",
    "print(eq1.to_str([\"x\", \"y\"]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "+(-1+0*i)*(y**2)+(-1+0*i)*x*y+(-1+0*i)*(x**3)+(-1+0*i)*(x**3)*y+(1+0*i)*E*(x**2)*y;\n"
     ]
    }
   ],
   "source": [
    "print(char_poly.num.to_str(csolver.CStrVec(['E', 'x', 'y'])))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# HN model"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "Jx1 = 1\n",
    "Jx2 = 1\n",
    "Jy1 = 0.8j\n",
    "Jy2 = 0.8j"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "coeffs = csolver.CScalarVec([\n",
    "    1, -Jx1, -Jx2, - Jy1, -Jy2\n",
    "])\n",
    "orders = csolver.CIntVec([\n",
    "    # E, beta1, beta2\n",
    "    1, 0, 0,\n",
    "    0, -1, 1,\n",
    "    0, 1, -1,\n",
    "    0, 0, -1,\n",
    "    0, 0, 1\n",
    "])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "char_poly = csolver.CLaurant(3)\n",
    "char_poly.set_Laurant_by_terms(coeffs, orders)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'+(-1+0*i)*(y**2)+(-0-0.800000000000000044*i)*x+(-0-0.800000000000000044*i)*x*(y**2)+(-1+0*i)*(x**2)+(1+0*i)*E*x*y;'"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "char_poly.num.to_str(csolver.CStrVec([\"E\", \"x\", \"y\"]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "checker = csolver.DirectGBZConditionChecker(char_poly, 1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "True\n"
     ]
    }
   ],
   "source": [
    "phi2 = np.random.rand() * 2 * np.pi\n",
    "# beta1 = np.random.rand() + 1j * np.random.rand()\n",
    "beta1 = np.sqrt(Jx1 * Jy1/(Jx2 * Jy2)) * np.exp(1j * 2 * np.pi * np.random.rand())\n",
    "beta2 = np.exp(1j * phi2/2) * np.sqrt((Jx2 * beta1 + Jy1)/(Jx1/beta1 + Jy2))\n",
    "E = Jx1 * beta2/beta1 + Jx2 * beta1/beta2 + Jy1/ beta2 + Jy2 * beta2\n",
    "res = checker.GBZ_condition_1d([E, beta1, beta2], beta1)\n",
    "print(res)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.5240765584142799\n",
      "0.9999999999999999\n",
      "(-0.7351837418794432-0.6778678821688929j)\n"
     ]
    }
   ],
   "source": [
    "print(phi2/np.pi)\n",
    "print(abs(beta1))\n",
    "print(beta1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[-0.2966-0.8282j  0.298 +0.2593j]\n",
      " [-0.3832+1.0702j  1.8565-1.7208j]]\n",
      "[[-0.2972-0.8282j  0.3064+0.25j  ]\n",
      " [-0.3839+1.0697j  1.8005-1.7753j]]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Newton solver fails, error solution: (8.58362902089086e-32-9.40628698737033e-32j) (-1.4791141972894e-31+8.87468518373638e-31j)\n",
      "The number of calls to function has reached maxfev = 500.\n",
      "Newton solver fails, error solution: (3.15852510879507e-32+7.70371977754894e-33j) (-3.65926689433575e-33+4.00593428432545e-32j)\n",
      "The number of calls to function has reached maxfev = 500.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[-0.2985-0.828j   0.315 +0.2406j]\n",
      " [-0.3853+1.0688j  1.7416-1.825j ]]\n",
      "[[-0.3874+1.0673j  1.6802-1.8701j]\n",
      " [-0.3005-0.8279j  0.3238+0.2311j]]\n",
      "[[-0.3031-0.8276j  0.3327+0.2213j]\n",
      " [-0.3902+1.0654j  1.6166-1.9101j]]\n",
      "[[-0.3937+1.063j   1.5512-1.9452j]\n",
      " [-0.3064-0.8273j  0.3419+0.2113j]]\n",
      "[[-0.3105-0.8268j  0.3513+0.2011j]\n",
      " [-0.398 +1.06j    1.4842-1.975j ]]\n",
      "[[-0.4031+1.0564j  1.4162-1.9996j]\n",
      " [-0.3153-0.8263j  0.3609+0.1905j]]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Newton solver fails, error solution: (6.93334779979405e-33+9.24446373305873e-33j) (-9.24446373305873e-33-6.16297582203915e-32j)\n",
      "The number of calls to function has reached maxfev = 500.\n",
      "Newton solver fails, error solution: (-1.38666955995881e-32+1.63704045272915e-32j) (-3.85185988877447e-34+1.42518815884655e-32j)\n",
      "The number of calls to function has reached maxfev = 500.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[-0.409 +1.0522j  1.3473-2.0189j]\n",
      " [-0.321 -0.8256j  0.3708+0.1795j]]\n",
      "[[-0.3275-0.8248j  0.381 +0.1681j]\n",
      " [-0.4158+1.0473j  1.2781-2.0328j]]\n",
      "[[-0.4235+1.0417j  1.2088-2.0412j]\n",
      " [-0.3349-0.8238j  0.3915+0.1562j]]\n",
      "[[-0.4322+1.0352j  1.1398-2.0442j]\n",
      " [-0.3434-0.8226j  0.4024+0.1437j]]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Newton solver fails, error solution: (-2.1570415377137e-32+1.23259516440783e-32j) (-1.69481835106077e-32+1.15555796663234e-32j)\n",
      "The number of calls to function has reached maxfev = 500.\n",
      "Newton solver fails, error solution: (-3.22029028396467e-33-2.75423028375065e-33j) (-3.0333396624099e-33+9.05187073862001e-32j)\n",
      "The number of calls to function has reached maxfev = 500.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[-0.3531-0.8211j  0.4136+0.1306j]\n",
      " [-0.4419+1.0278j  1.0716-2.0417j]]\n",
      "[[-0.3639-0.8193j  0.4251+0.1167j]\n",
      " [-0.4528+1.0194j  1.0044-2.0337j]]\n",
      "[[-0.4648+1.0098j  0.9387-2.0203j]\n",
      " [-0.3761-0.8172j  0.4371+0.102j ]]\n",
      "[[-0.4781+0.9989j  0.8749-2.0014j]\n",
      " [-0.3899-0.8145j  0.4496+0.0863j]]\n",
      "[[-0.4053-0.8113j  0.4626+0.0694j]\n",
      " [-0.4928+0.9864j  0.8133-1.9771j]]\n",
      "[[-0.509 +0.9721j  0.7543-1.9473j]\n",
      " [-0.4227-0.8073j  0.4761+0.0512j]]\n",
      "[[-0.5269+0.9558j  0.6982-1.9122j]\n",
      " [-0.4424-0.8024j  0.4902+0.0314j]]\n",
      "[[-0.4645-0.7964j  0.505 +0.0098j]\n",
      " [-0.5465+0.9369j  0.6456-1.8716j]]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Newton solver fails, error solution: (9.24446373305873e-33+1.54074395550979e-32j) (1.07852076885685e-32-1.92592994438724e-32j)\n",
      "The number of calls to function has reached maxfev = 500.\n",
      "Newton solver fails, error solution: (-1.92592994438724e-31-3.6361557350031e-31j) (1.54074395550979e-31-9.24446373305873e-33j)\n",
      "The number of calls to function has reached maxfev = 500.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[-0.4897-0.7888j  0.5205-0.014j ]\n",
      " [-0.5681+0.9151j  0.5967-1.8256j]]\n",
      "[[-0.5916+0.8897j  0.5519-1.774j ]\n",
      " [-0.5183-0.7794j  0.5368-0.0403j]]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Newton solver fails, error solution: (2.77333911991762e-32-2.46519032881566e-32j) (9.24446373305873e-33+1.69481835106077e-32j)\n",
      "The number of calls to function has reached maxfev = 500.\n",
      "Newton solver fails, error solution: (-2.28704180895984e-34+5.20001084984554e-33j) (-1.09778006830072e-32-5.77778983316171e-33j)\n",
      "The number of calls to function has reached maxfev = 500.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[-0.551 -0.7674j  0.5539-0.0699j]\n",
      " [-0.6174+0.8598j  0.5116-1.7165j]]\n",
      "[[-0.6454+0.8244j  0.4761-1.6529j]\n",
      " [-0.5888-0.7521j  0.5721-0.1035j]]\n",
      "[[-0.6327-0.7323j  0.5914-0.142j ]\n",
      " [-0.6755+0.7819j  0.4459-1.5826j]]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Newton solver fails, error solution: (-6.93334779979405e-33-1.23259516440783e-32j) (1.84889274661175e-32+2.31111593326468e-33j)\n",
      "The number of calls to function has reached maxfev = 500.\n",
      "Newton solver fails, error solution: (6.64445830813596e-33-6.16297582203915e-33j) (7.70371977754894e-33+4.0444528832132e-33j)\n",
      "The number of calls to function has reached maxfev = 500.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[-0.6843-0.7063j  0.6122-0.1869j]\n",
      " [-0.7076+0.7303j  0.4211-1.5045j]]\n",
      "[[-0.7407+0.6662j  0.4017-1.4169j]\n",
      " [-0.7463-0.6713j  0.6349-0.2406j]]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Newton solver fails, error solution: (-6.16297582203915e-32+3.69778549322349e-32j) (-4.00593428432545e-32+1.84889274661175e-32j)\n",
      "The number of calls to function has reached maxfev = 500.\n",
      "Newton solver fails, error solution: (-9.24446373305873e-33+1.1170393677446e-32j) (-2.22444908576726e-32+3.08148791101958e-33j)\n",
      "The number of calls to function has reached maxfev = 500.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[-0.8229-0.6231j  0.6609-0.3067j]\n",
      " [-0.7724+0.5848j  0.3873-1.3168j]]\n",
      "[[-0.9232-0.5542j  0.6935-0.3918j]\n",
      " [-0.7962+0.478j   0.3748-1.1982j]]\n",
      "[[-1.0724-0.4555j  0.7467-0.5066j]\n",
      " [-0.79  +0.3355j  0.3513-1.0511j]]\n",
      "[[-1.3265-0.3623j  0.8632-0.6363j]\n",
      " [-0.7015+0.1916j  0.2749-0.8911j]]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Newton solver fails, error solution: (-2.46519032881566e-32+8.39705455752835e-32j) (-3.61593347058704e-32-3.69778549322349e-32j)\n",
      "The number of calls to function has reached maxfev = 500.\n",
      "Newton solver fails, error solution: (-6.16297582203915e-32+1.23259516440783e-32j) (-3.85185988877447e-33-5.54667823983524e-32j)\n",
      "The number of calls to function has reached maxfev = 500.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[-1.6387-0.3566j  1.0193-0.7154j]\n",
      " [-0.5826+0.1268j  0.1701-0.7848j]]\n",
      "[[-1.9586-0.3994j  1.1677-0.7663j]\n",
      " [-0.4902+0.1j     0.0855-0.7109j]]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Newton solver fails, error solution: (2.19556013660145e-32-1.56000325495366e-32j) (3.31259950434605e-32+0j)\n",
      "The number of calls to function has reached maxfev = 500.\n",
      "Newton solver fails, error solution: (-5.23852944873328e-32+4.31408307542741e-32j) (-7.39557098644699e-32-3.69778549322349e-32j)\n",
      "The number of calls to function has reached maxfev = 500.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[-0.4174+0.0846j  0.0198-0.6483j]\n",
      " [-2.3011-0.4666j  1.311 -0.8113j]]\n",
      "[[-2.6844-0.5547j  1.4557-0.8581j]\n",
      " [-0.3573+0.0738j -0.0316-0.5909j]]\n",
      "[[-0.3059+0.0651j -0.0718-0.5366j]\n",
      " [-3.1274-0.6659j  1.6068-0.9108j]]\n",
      "[[-3.6527-0.8054j  1.769 -0.9724j]\n",
      " [-0.2611+0.0576j -0.1026-0.4847j]]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Newton solver fails, error solution: (6.47112461314111e-32-9.24446373305873e-32j) (6.77927340424307e-32-2.1570415377137e-32j)\n",
      "The number of calls to function has reached maxfev = 500.\n",
      "Newton solver fails, error solution: (-1.34044724129352e-30-4.68097272983318e-31j) (2.26874547448816e-31-1.28498045889516e-30j)\n",
      "The number of calls to function has reached maxfev = 500.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[-0.2215+0.0507j -0.1253-0.4347j]\n",
      " [-4.2907-0.9816j  1.9471-1.0461j]]\n",
      "[[-0.1862+0.0442j -0.141 -0.3868j]\n",
      " [-5.0839-1.2071j  2.1469-1.136j ]]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Newton solver fails, error solution: (3.69778549322349e-32+4.93038065763132e-32j) (-1.17096540618744e-31+8.0118685686509e-32j)\n",
      "The number of calls to function has reached maxfev = 500.\n",
      "Newton solver fails, error solution: (9.24446373305873e-33+3.08148791101958e-33j) (-7.24149659089601e-32+3.38963670212154e-32j)\n",
      "The number of calls to function has reached maxfev = 500.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[-0.1547+0.0381j -0.1504-0.341j ]\n",
      " [-6.095 -1.5008j  2.3757-1.247j ]]\n",
      "[[-7.4198-1.8918j  2.6433-1.3862j]\n",
      " [-0.1265+0.0323j -0.1542-0.2975j]]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Newton solver fails, error solution: (-3.92889708654996e-32-1.23259516440783e-32j) (4.00593428432545e-32-2.715561221586e-32j)\n",
      "The number of calls to function has reached maxfev = 500.\n",
      "Newton solver fails, error solution: (-1.4637067577343e-32-7.70371977754894e-34j) (1.69481835106077e-32-4.93038065763132e-32j)\n",
      "The number of calls to function has reached maxfev = 500.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[-9.2114-2.4269j  2.9638-1.5639j]\n",
      " [-0.1015+0.0267j -0.153 -0.2562j]]\n",
      "[[-11.7276-3.185j    3.358 -1.7953j]\n",
      " [ -0.0794+0.0216j  -0.1473-0.2175j]]\n",
      "[[ -0.0601+0.0168j  -0.1376-0.1812j]\n",
      " [-15.43  -4.3075j   3.8588-2.1048j]]\n",
      "[[-21.2146-6.0684j   4.5218-2.5336j]\n",
      " [ -0.0436+0.0125j  -0.1244-0.1475j]]\n",
      "[[ -0.0297+0.0087j  -0.1081-0.1163j]\n",
      " [-31.012 -9.0589j   5.449 -3.157j ]]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Newton solver fails, error solution: (-8.0118685686509e-32+2.23099724757817e-30j) (-3.31568099225707e-30+9.92239107348304e-31j)\n",
      "The number of calls to function has reached maxfev = 500.\n",
      "Newton solver fails, error solution: (1.54074395550979e-33+7.70371977754894e-34j) (-9.24446373305873e-33+3.08148791101958e-33j)\n",
      "The number of calls to function has reached maxfev = 500.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[-49.6412-14.7537j   6.8508 -4.131j ]\n",
      " [ -0.0185 +0.0055j  -0.0891 -0.0877j]]\n",
      "[[-92.1144-27.7473j   9.2431 -5.8375j]\n",
      " [ -0.01   +0.003j   -0.0678 -0.0614j]]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Newton solver fails, error solution: (5.34445559567458e-32+3.620748295448e-32j) (-1.09392820841195e-31+9.36001952972197e-32j)\n",
      "The number of calls to function has reached maxfev = 500.\n",
      "Newton solver fails, error solution: (-2.9274135154686e-32-4.85334345985583e-32j) (3.38963670212154e-31-7.08742219534503e-32j)\n",
      "The number of calls to function has reached maxfev = 500.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[-227.0336-69.0352j   14.3198 -9.5298j]\n",
      " [  -0.004  +0.0012j   -0.0446 -0.0373j]]\n",
      "[[-1232.7025-376.8141j    32.7932 -23.1326j]\n",
      " [   -0.0007  +0.0002j    -0.0197  -0.0153j]]\n",
      "[[-11243.9454-3440.7139j    -96.8937  +72.8637j]\n",
      " [    -0.0001   +0.j          0.0067   +0.0049j]]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Newton solver fails, error solution: (6.19466714973732e-33-6.30478746052236e-33j) (-2.5260497150583e-30+1.68249239941669e-30j)\n",
      "The number of calls to function has reached maxfev = 500.\n",
      "Newton solver fails, error solution: (-1.33852131134913e-32+2.76563540014007e-31j) (2.43129396179445e-30-2.36658271566304e-30j)\n",
      "The number of calls to function has reached maxfev = 500.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[  -0.002   +0.0006j    0.0342  +0.0234j]\n",
      " [-446.3243-136.147j   -18.7902 +15.1481j]]\n",
      "[[  -0.0066 +0.002j     0.0627 +0.0406j]\n",
      " [-137.7809-41.7213j  -10.104  +8.7814j]]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Newton solver fails, error solution: (-2.31111593326468e-33+2.34963453215243e-32j) (-2.31111593326468e-32+1.71070727310196e-31j)\n",
      "The number of calls to function has reached maxfev = 500.\n",
      "Newton solver fails, error solution: (4.53363908908755e-31-2.47289404859321e-31j) (-2.20942683220104e-30+9.05957445839756e-31j)\n",
      "The number of calls to function has reached maxfev = 500.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[ -0.0139 +0.0042j   0.092  +0.0568j]\n",
      " [-66.1217-19.7947j  -6.7311 +6.3428j]]\n",
      "[[-38.7382-11.4199j  -4.9187 +5.0556j]\n",
      " [ -0.0238 +0.007j    0.1221 +0.0721j]]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Newton solver fails, error solution: (1.61778115328528e-32+1.88741134549949e-32j) (2.46519032881566e-32-2.9274135154686e-32j)\n",
      "The number of calls to function has reached maxfev = 500.\n",
      "Newton solver fails, error solution: (-2.40356057059527e-31-9.05957445839756e-31j) (-4.43734259186819e-31+8.25838760153247e-31j)\n",
      "The number of calls to function has reached maxfev = 500.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[-25.4415-7.3579j  -3.7742+4.2591j]\n",
      " [ -0.0363+0.0105j   0.1527+0.0869j]]\n",
      "[[-17.9918-5.0866j  -2.9765+3.715j ]\n",
      " [ -0.0515+0.0146j   0.1839+0.1016j]]\n",
      "[[ -0.0694+0.0191j   0.2155+0.1163j]\n",
      " [-13.3982-3.6908j  -2.382 +3.3166j]]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Newton solver fails, error solution: (-1.84889274661175e-32+4.00593428432545e-32j) (4.93038065763132e-32+1.01689101063646e-31j)\n",
      "The number of calls to function has reached maxfev = 500.\n",
      "Newton solver fails, error solution: (4.62223186652937e-33+1.38666955995881e-32j) (-2.69630192214213e-33+0j)\n",
      "The number of calls to function has reached maxfev = 500.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[ -0.09  +0.0241j   0.2476+0.1314j]\n",
      " [-10.3629-2.7732j  -1.9166+3.0086j]]\n",
      "[[-0.1136+0.0295j  0.2802+0.1473j]\n",
      " [-8.2489-2.1388j -1.5388+2.7594j]]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Newton solver fails, error solution: (1.24800260396293e-31-6.16297582203915e-33j) (-9.86076131526265e-32-7.70371977754894e-32j)\n",
      "The number of calls to function has reached maxfev = 500.\n",
      "Newton solver fails, error solution: (-6.16297582203915e-33-1.50992907639959e-31j) (3.20474742746036e-31+2.46519032881566e-32j)\n",
      "The number of calls to function has reached maxfev = 500.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[-6.7137-1.6827j -1.2231+2.5496j]\n",
      " [-0.1401+0.0351j  0.3132+0.1642j]]\n",
      "[[-5.5598-1.3447j -0.9534+2.3667j]\n",
      " [-0.1699+0.0411j  0.3468+0.1826j]]\n",
      "[[-0.2032+0.0474j  0.381 +0.203j ]\n",
      " [-4.6666-1.0878j -0.719 +2.2019j]]\n",
      "[[-3.9569-0.8887j -0.5127+2.0489j]\n",
      " [-0.2406+0.054j   0.4161+0.2259j]]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Newton solver fails, error solution: (1.10933564796705e-31-3.08148791101958e-31j) (-1.66400347195057e-31+2.48059776837076e-31j)\n",
      "The number of calls to function has reached maxfev = 500.\n",
      "Newton solver fails, error solution: (1.48537346960866e-32+1.27833600058703e-32j) (-4.91112135818745e-32-5.4425576522168e-32j)\n",
      "The number of calls to function has reached maxfev = 500.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[-3.3794-0.732j  -0.3294+1.9028j]\n",
      " [-0.2826+0.0612j  0.4523+0.2522j]]\n",
      "[[-0.3305+0.0693j  0.49  +0.2829j]\n",
      " [-2.8983-0.6074j -0.1657+1.7595j]]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Newton solver fails, error solution: 1.54074395550979e-33j (-3.18982147039136e-33+9.24446373305873e-33j)\n",
      "The number of calls to function has reached maxfev = 500.\n",
      "Newton solver fails, error solution: (2.1570415377137e-32+5.54667823983524e-32j) (-1.07852076885685e-32-4.6174170416684e-32j)\n",
      "The number of calls to function has reached maxfev = 500.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[-2.4875-0.5082j -0.0198+1.6152j]\n",
      " [-0.3859+0.0788j  0.5301+0.3197j]]\n",
      "[[-2.1267-0.4306j  0.109 +1.4656j]\n",
      " [-0.4517+0.0914j  0.574 +0.3653j]]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Newton solver fails, error solution: (6.16297582203915e-33+6.16297582203915e-32j) (-2.46519032881566e-32-9.51409392527295e-32j)\n",
      "The number of calls to function has reached maxfev = 500.\n",
      "Newton solver fails, error solution: (3.08148791101958e-33+6.16297582203915e-33j) (1.34815096107107e-32-6.16297582203915e-33j)\n",
      "The number of calls to function has reached maxfev = 500.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[-1.7978-0.3744j  0.2186+1.3048j]\n",
      " [-0.5331+0.111j   0.6256+0.4243j]]\n",
      "[[-0.6389+0.1509j  0.6964+0.5044j]\n",
      " [-1.4825-0.3501j  0.2983+1.124j ]]\n",
      "[[-1.1851-0.4003j  0.3098+0.9309j]\n",
      " [-0.7574+0.2558j  0.8259+0.5974j]]\n",
      "[[-0.9891-0.5086j  0.2602+0.8017j]\n",
      " [-0.7996+0.4112j  1.0076+0.6264j]]\n",
      "[[-0.7861+0.535j   1.1715+0.6005j]\n",
      " [-0.8694-0.5917j  0.2199+0.7271j]]\n",
      "[[-0.757 +0.6279j  1.3129+0.5515j]\n",
      " [-0.7826-0.6491j  0.1943+0.6748j]]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Newton solver fails, error solution: (7.68157346397945e-33-4.03866945100715e-33j) (1.28375267855562e-32+5.15186260123586e-33j)\n",
      "The number of calls to function has reached maxfev = 500.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[-0.7242+0.6999j  1.4371+0.4903j]\n",
      " [-0.714 -0.69j    0.1781+0.634j ]]\n",
      "[[-0.6915+0.7573j  1.5477+0.4209j]\n",
      " [-0.6575-0.7201j  0.1682+0.6004j]]\n",
      "[[-0.6603+0.804j   1.6468+0.3457j]\n",
      " [-0.61  -0.7428j  0.1626+0.5716j]]\n",
      "[[-0.5693-0.7602j  0.1599+0.5466j]\n",
      " [-0.6312+0.8428j  1.7358+0.2659j]]\n",
      "[[-0.6043+0.8753j  1.8157+0.1824j]\n",
      " [-0.5342-0.7737j  0.1595+0.5243j]]\n",
      "[[-0.5796+0.9028j  1.8871+0.0959j]\n",
      " [-0.5036-0.7843j  0.1607+0.5043j]]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Newton solver fails, error solution: (3.19704370768281e-32-8.8111294955716e-33j) (1.84889274661175e-32-5.24815909845522e-32j)\n",
      "The number of calls to function has reached maxfev = 500.\n",
      "Newton solver fails, error solution: (-2.77333911991762e-32-2.1570415377137e-32j) (2.46519032881566e-32-1.30963236218332e-32j)\n",
      "The number of calls to function has reached maxfev = 500.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[-0.5571+0.9264j  1.9505+0.0069j]\n",
      " [-0.4768-0.7928j  0.1631+0.4861j]]\n",
      "[[-0.5365+0.9466j  2.0063-0.084j ]\n",
      " [-0.4532-0.7995j  0.1665+0.4693j]]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Newton solver fails, error solution: (4.62223186652937e-32+6.16297582203915e-33j) (-9.8222427163749e-33-8.85927774418128e-33j)\n",
      "The number of calls to function has reached maxfev = 500.\n",
      "Newton solver fails, error solution: (-2.46519032881566e-32+1.23259516440783e-32j) (2.1570415377137e-32-3.08148791101958e-33j)\n",
      "The number of calls to function has reached maxfev = 500.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[-0.4323-0.805j   0.1706+0.4539j]\n",
      " [-0.5178+0.9642j  2.0547-0.1764j]]\n",
      "[[-0.4138-0.8094j  0.1754+0.4395j]\n",
      " [-0.5008+0.9795j  2.096 -0.2699j]]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Newton solver fails, error solution: (1.83166470140609e-32-7.82108113353504e-33j) (-5.31941850639755e-31+7.83468301376728e-31j)\n",
      "The number of calls to function has reached maxfev = 500.\n",
      "Newton solver fails, error solution: (-3.08148791101958e-32+1.72563323017096e-31j) (6.16297582203915e-33-2.1570415377137e-32j)\n",
      "The number of calls to function has reached maxfev = 500.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[-0.3974-0.813j   0.1806+0.426j ]\n",
      " [-0.4853+0.9928j  2.1304-0.3641j]]\n",
      "[[-0.3828-0.8159j  0.1862+0.4132j]\n",
      " [-0.4713+1.0045j  2.1581-0.4586j]]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Newton solver fails, error solution: (-1.84889274661175e-30+2.69938341005315e-30j) (6.03971630559837e-31-1.38975104786983e-30j)\n",
      "The number of calls to function has reached maxfev = 500.\n",
      "Newton solver fails, error solution: (-1.03615031008033e-31+1.04069430104287e-31j) -2.05689318060557e-31j\n",
      "The number of calls to function has reached maxfev = 500.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[-0.3699-0.8183j  0.1921+0.4011j]\n",
      " [-0.4587+1.0147j  2.1791-0.5531j]]\n",
      "[[-0.4472+1.0237j  2.1938-0.6473j]\n",
      " [-0.3583-0.8203j  0.1983+0.3896j]]\n",
      "[[-0.437 +1.0316j  2.2022-0.7407j]\n",
      " [-0.3481-0.8219j  0.2048+0.3786j]]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Newton solver fails, error solution: (-6.16297582203915e-33+3.69778549322349e-32j) (1.00629839594233e-32+8.66668474974256e-34j)\n",
      "The number of calls to function has reached maxfev = 500.\n",
      "Newton solver fails, error solution: (-3.08148791101958e-32+8.55112895307933e-32j) 2.31111593326468e-33j\n",
      "The number of calls to function has reached maxfev = 500.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[-0.4278+1.0385j  2.2045-0.8331j]\n",
      " [-0.3391-0.8232j  0.2114+0.3679j]]\n",
      "[[-0.3311-0.8243j  0.2182+0.3576j]\n",
      " [-0.4196+1.0446j  2.2009-0.9241j]]\n",
      "[[-0.4123+1.0498j  2.1916-1.0133j]\n",
      " [-0.3241-0.8252j  0.2251+0.3476j]]\n",
      "[[-0.406 +1.0544j  2.1766-1.1006j]\n",
      " [-0.318 -0.826j   0.2322+0.3379j]]\n",
      "[[-0.4005+1.0583j  2.1564-1.1855j]\n",
      " [-0.3128-0.8266j  0.2395+0.3283j]]\n",
      "[[-0.3084-0.8271j  0.2468+0.3189j]\n",
      " [-0.3958+1.0615j  2.1309-1.2678j]]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Newton solver fails, error solution: (1.03217807957003e-33+9.62964972193618e-35j) (3.85185988877447e-34-8.85927774418128e-33j)\n",
      "The number of calls to function has reached maxfev = 500.\n",
      "Newton solver fails, error solution: (-8.64561989097583e-33+1.90636971838955e-33j) (-1.0862244886344e-31-1.4791141972894e-31j)\n",
      "The number of calls to function has reached maxfev = 500.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[-0.3919+1.0643j  2.1006-1.3472j]\n",
      " [-0.3047-0.8274j  0.2543+0.3097j]]\n",
      "[[-0.3017-0.8277j  0.262 +0.3005j]\n",
      " [-0.3887+1.0664j  2.0656-1.4234j]]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Newton solver fails, error solution: (3.99630463460351e-33-2.262967684655e-32j) (-7.70371977754894e-32-9.62964972193618e-34j)\n",
      "The number of calls to function has reached maxfev = 500.\n",
      "Newton solver fails, error solution: (2.64815367353245e-34-5.91019751683833e-33j) (-2.9274135154686e-32-7.70371977754894e-33j)\n",
      "The number of calls to function has reached maxfev = 500.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[-0.3863+1.0681j  2.0261-1.4962j]\n",
      " [-0.2994-0.828j   0.2697+0.2914j]]\n",
      "[[-0.2978-0.8281j  0.2776+0.2823j]\n",
      " [-0.3845+1.0693j  1.9825-1.5653j]]\n",
      "[[-0.2968-0.8282j  0.2856+0.2731j]\n",
      " [-0.3835+1.07j    1.9349-1.6305j]]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Newton solver fails, error solution: (-7.90233130306388e-33+1.27352117572606e-32j) (3.69778549322349e-32+1.01689101063646e-31j)\n",
      "The number of calls to function has reached maxfev = 500.\n"
     ]
    }
   ],
   "source": [
    "for curr_phi2 in np.linspace(np.pi/100, 2*np.pi*99/100, 100):\n",
    "    all_sols = checker.get_aGBZ_solutions([E, beta1, beta2], [np.exp(1j*curr_phi2), np.exp(1j * curr_phi2)])\n",
    "    print(all_sols)\n",
    "    plt.plot(all_sols[:,0].real, all_sols[:,0].imag,'.')\n",
    "plt.plot(np.abs(beta1) * np.cos(np.linspace(0, 2*np.pi, 100)), \n",
    "            np.abs(beta1) * np.sin(np.linspace(0, 2*np.pi, 100)), \n",
    "            'r-')\n",
    "plt.plot(beta1.real, beta1.imag, 'x')\n",
    "# plt.plot((beta1*np.exp(1j * phi2)).real, beta1.imag, 'x')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Number of solutions"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "char_poly = minimal_winding_char_poly()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "+(-1+0*i)*(y**2)+(-1+0*i)*x*y+(-0.100000000000000006+0*i)*x*(y**2)+(-1+0*i)*(x**3)+(-1+0*i)*(x**3)*y+(-0.100000000000000006+0*i)*(x**4)+(1+0*i)*E*(x**2)*y;\n"
     ]
    }
   ],
   "source": [
    "print(char_poly.num.to_str(csolver.CStrVec([\"E\", \"x\", 'y'])))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "curr_E = 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "# find all solutions\n",
    "phi = np.pi/4\n",
    "eff_poly1 =csolver.CPolyLinkedList(2)\n",
    "char_poly.num.partial_eval(csolver.CScalarVec([curr_E]), csolver.CIndexVec([0]), csolver.CIndexVec([1,2]), eff_poly1)\n",
    "eff_poly2 = eff_poly1.scale_var(csolver.CScalarVec([1, np.exp(1j * phi)]))\n",
    "# eff_poly2 = eff_poly1.scale_var(csolver.CScalarVec([np.exp(1j * phi), 1]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[0 2]\n",
      " [1 1]\n",
      " [2 1]\n",
      " [3 0]\n",
      " [3 1]]\n",
      "[[0 2]\n",
      " [1 1]\n",
      " [2 1]\n",
      " [3 0]\n",
      " [3 1]]\n"
     ]
    }
   ],
   "source": [
    "coeffs, orders = eff_poly1.batch_get_data()\n",
    "print(orders)\n",
    "coeffs, orders = eff_poly2.batch_get_data()\n",
    "print(orders)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['+(-1+0*i)*(y**2)+(-1+0*i)*x*y+(1+0*i)*(x**2)*y+(-1+0*i)*(x**3)+(-1+0*i)*(x**3)*y;', '+(-6.12323399573676604e-17-1*i)*(y**2)+(-0.707106781186547573-0.707106781186547462*i)*x*y+(0.707106781186547573+0.707106781186547462*i)*(x**2)*y+(-1+0*i)*(x**3)+(-0.707106781186547573-0.707106781186547462*i)*(x**3)*y;']\n"
     ]
    }
   ],
   "source": [
    "eq_list = [\n",
    "    eff_poly1.to_str(['x', 'y']),\n",
    "    eff_poly2.to_str(['x', 'y'])\n",
    "]\n",
    "print(eq_list)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "total degree : 16\n",
      "2-homogeneous Bezout number : 12\n",
      "  with with partition : { y }{ x }\n",
      "general linear-product Bezout number : 11\n",
      "  based on the set structure :\n",
      "     { y }{ y x }{ x }{ x }\n",
      "     { y }{ y x }{ x }{ x }\n",
      "mixed volume : 4\n",
      "stable mixed volume : 9\n"
     ]
    }
   ],
   "source": [
    "all_sols = phcpy.solver.solve(eq_list, dictionary_output=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'t': 0j, 'm': 5, 'err': 1.499e-17, 'rco': 0.0, 'res': 0.0, 'y': 0j, 'x': 0j}\n",
      "{'t': (1+0j), 'm': 1, 'err': 1.897e-16, 'rco': 0.1192, 'res': 3.331e-16, 'y': (-0.82350905058283+1.92458739744312j), 'x': (-0.0126720721280381+1.63638127869506j)}\n",
      "{'t': (1+0j), 'm': 1, 'err': 1.565e-16, 'rco': 0.1328, 'res': 8.163e-16, 'y': (-2.26876189982829+0.939751948704227j), 'x': (1.82018577615019+9.52215332468747e-17j)}\n",
      "{'t': (1+0j), 'm': 1, 'err': 5.212e-16, 'rco': 0.1579, 'res': 1.943e-16, 'y': (-1.94319763375381-0.778579965682583j), 'x': (-0.012672072128038-1.63638127869506j)}\n",
      "{'t': (1+0j), 'm': 1, 'err': 3.542e-17, 'rco': 0.3628, 'res': 1.393e-18, 'y': (-0.0858517593947086+0.0355609630948801j), 'x': (0.205158368105885-1.35989194645641e-17j)}\n"
     ]
    }
   ],
   "source": [
    "for sol in all_sols:\n",
    "    print(sol)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "def solve_1d_equation(char_poly:csolver.CLaurant, curr_E, curr_beta, which_var):\n",
    "    if(which_var == 1):\n",
    "        other_var = 2\n",
    "    else:\n",
    "        other_var = 1\n",
    "    eff_poly_1d = csolver.CPolyLinkedList(1)\n",
    "    char_poly.num.partial_eval(csolver.CScalarVec([curr_E, curr_beta]), csolver.CIndexVec([0, which_var]),\n",
    "                            csolver.CIndexVec([other_var]), eff_poly_1d)\n",
    "    coeffs, degrees = eff_poly_1d.batch_get_data()\n",
    "    degrees = degrees.flatten()\n",
    "    max_deg = np.max(degrees)\n",
    "\n",
    "\n",
    "    all_coeffs = np.zeros(max_deg + 1, dtype=complex)\n",
    "    for j in range(len(degrees)):\n",
    "        all_coeffs[max_deg - degrees[j]] = coeffs[j]\n",
    "\n",
    "    all_roots = np.roots(all_coeffs)\n",
    "    seq = np.argsort(np.abs(all_roots))\n",
    "    return all_roots[seq]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 1.-0.j, -1.+0.j])"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solve_1d_equation(char_poly, 1, np.exp(1j*np.pi/3), 1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "r_arr = np.linspace(1e-3, 1, 50)\n",
    "phi_arr = np.linspace(0, 2*np.pi, 50)\n",
    "r_mesh, phi_mesh = np.meshgrid(r_arr, phi_arr)\n",
    "beta_mesh = r_mesh * np.exp(1j * phi_mesh)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "curr_E = 1\n",
    "which_var = 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "if (which_var == 1):\n",
    "    all_roots = np.zeros((2,) + beta_mesh.shape, dtype=complex)\n",
    "else:\n",
    "    all_roots = np.zeros((4,) + beta_mesh.shape, dtype=complex)\n",
    "\n",
    "for i in range(beta_mesh.shape[0]):\n",
    "    for j in range(beta_mesh.shape[1]):\n",
    "        all_roots[:,i,j] = solve_1d_equation(char_poly, curr_E, beta_mesh[i,j], which_var)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pyvista as pv"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "pv.set_jupyter_backend('client')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "f5df979f8b0e4f01b61a8ee91d8b9ccb",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Widget(value=\"<iframe src='http://localhost:33007/index.html?ui=P_0x7f70eda06a60_0&reconnect=auto' style='widt…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "mesh_list = []\n",
    "for j in range(all_roots.shape[0]):\n",
    "    mesh_list.append(\n",
    "        pv.StructuredGrid(beta_mesh.real, beta_mesh.imag, np.abs(all_roots[j,:,:]))\n",
    "    )\n",
    "\n",
    "plotter = pv.Plotter()\n",
    "color = [(255,0,0), (0,0,255)]\n",
    "for j in range(all_roots.shape[0]):\n",
    "    plotter.add_mesh(mesh_list[j], color=color[j])\n",
    "plotter.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {},
   "outputs": [],
   "source": [
    "fig = plt.figure()\n",
    "ax = fig.add_subplot(projection='3d')\n",
    "for j in range(2):\n",
    "    ax.plot_surface(beta_mesh.real, beta_mesh.imag, np.abs(all_roots[j,:,:]))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "base",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.16"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
